Skip to content

Instantly share code, notes, and snippets.

@hiasinho
Created January 9, 2012 15:50
Show Gist options
  • Save hiasinho/1583522 to your computer and use it in GitHub Desktop.
Save hiasinho/1583522 to your computer and use it in GitHub Desktop.
Regex for decimal with unit
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