Skip to content

Instantly share code, notes, and snippets.

@sthawali
Created December 4, 2013 12:46
Show Gist options
  • Save sthawali/7786931 to your computer and use it in GitHub Desktop.
Save sthawali/7786931 to your computer and use it in GitHub Desktop.
Validate price in (xx.xx/xxx.xx/xxx.xxx) format. Change the limit for your formats.
var regex = /^\d{0,3}(\.\d{1,2})?$/; // This will validate for (xxx.xx) format.
if(regex.test(PRICE_VALUE)) {
// Right format
} else {
// Wrong format
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment