Skip to content

Instantly share code, notes, and snippets.

@murajun1978
Created January 4, 2013 14:55
Show Gist options
  • Save murajun1978/4453121 to your computer and use it in GitHub Desktop.
Save murajun1978/4453121 to your computer and use it in GitHub Desktop.
Using Variables in Ruby Regular Expression.
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