Created
January 9, 2012 15:50
-
-
Save hiasinho/1583522 to your computer and use it in GitHub Desktop.
Regex for decimal with unit
This file contains 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
matchdata = "121,32 Std.".match(/([\d]+[\,|\.]?\d{0,2})+\s?(\w.*)?/) | |
matchdata[1] # => "121,32" | |
matchdata[2] # => "Std." | |
matchdata[0] # => "121,32 Std." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment