Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- match = string.match(/regex/)[0].to_s
- irb(main):003:0> names = "erik kalle johan anders erik kalle johan anders"
- => "erik kalle johan anders erik kalle johan anders"
- irb(main):004:0> names[/kalle/]
- => "kalle"
- /regexp/ =~ "string"
- matchData = "string string".match(/string/)
- matchData[0] # => "string"
- matchData[1] # => nil - it's the first capture group not a second match
Add Comment
Please, Sign In to add comment