Created
October 2, 2013 19:25
-
-
Save johnsinco/6799177 to your computer and use it in GitHub Desktop.
ruby double-regex-error
This file contains hidden or 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
# do something cool with input using a case | |
input = "some fool string" | |
case input | |
when /foo/ | |
# do something | |
when /bar/ | |
# do something else | |
when /(fool)/ | |
# now do something special using the capture | |
local_var = $1 # get the capture | |
p "local capture is #{$1}" | |
local_var.gsub(/o/,'a') | |
p "local capture is #{$1}" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment