Skip to content

Instantly share code, notes, and snippets.

@bitprophet
Created October 19, 2009 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitprophet/212971 to your computer and use it in GitHub Desktop.
Save bitprophet/212971 to your computer and use it in GitHub Desktop.
rb(main):002:0> "bobsmith".match(/(b.b)(.+)/)
=> #<MatchData "bobsmith" 1:"bob" 2:"smith">
irb(main):003:0> result = "bobsmith".match(/(b.b)(.+)/)
=> #<MatchData "bobsmith" 1:"bob" 2:"smith">
irb(main):004:0> result[0]
=> "bobsmith"
irb(main):005:0> result[1]
=> "bob"
irb(main):006:0> result[2]
=> "smith"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment