Created
October 31, 2013 13:33
-
-
Save marji/7249796 to your computer and use it in GitHub Desktop.
Bash has regular expression built in. Temporary file, please ignore.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
string="matchthis, but not this" | |
pattern="([a-z]+)" | |
[[ $string =~ $pattern ]] | |
result=${BASH_REMATCH[1]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment