Created
April 27, 2011 14:36
-
-
Save tiegz/944349 to your computer and use it in GitHub Desktop.
Ruby 1.9 Named Regexp Groups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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