Created
January 4, 2013 14:55
-
-
Save murajun1978/4453121 to your computer and use it in GitHub Desktop.
Using Variables in Ruby Regular Expression.
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
foo = "hogehoge" | |
bar = "hoge" | |
foo.scan(/#{bar}/) # => ["hoge", "hoge"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment