Skip to content

Instantly share code, notes, and snippets.

@tiegz
Created April 27, 2011 14:36
Show Gist options
  • Save tiegz/944349 to your computer and use it in GitHub Desktop.
Save tiegz/944349 to your computer and use it in GitHub Desktop.
Ruby 1.9 Named Regexp Groups
if /(?<hour>\d?\d)\:(?<min>\d\d)(?<suffix>[pa]m)/ =~ "5:03pm"
puts hour
puts min
puts suffix
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment