Skip to content

Instantly share code, notes, and snippets.

Created July 29, 2012 15:24
Show Gist options
  • Save anonymous/3199461 to your computer and use it in GitHub Desktop.
Save anonymous/3199461 to your computer and use it in GitHub Desktop.
str = '1/2'
regex = /(?<group1>\d+)\/(?<group1>\d+)/
str.gsub!(regex) do |match|
match['group1'] = '3'
match['group2'] = '4'
match
end
IndexError: string not matched
from (irb):9:in `[]='
from (irb):9:in `block in irb_binding'
from (irb):8:in `gsub!'
from (irb):8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment