Skip to content

Instantly share code, notes, and snippets.

@oleander
Last active August 29, 2015 14:07
Show Gist options
  • Save oleander/f72defe30372d920ce22 to your computer and use it in GitHub Desktop.
Save oleander/f72defe30372d920ce22 to your computer and use it in GitHub Desktop.
"THX1138.".scan /(?<prefix>[A-Z]+)(?<hyphen>-?)(?<digits>\d+)/
=> [["THX", "", "1138"]]
"THX1138.".match /(?<prefix>[A-Z]+)(?<hyphen>-?)(?<digits>\d+)/
=> #<MatchData "THX1138" prefix:"THX" hyphen:"" digits:"1138">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment