Regular expressions for validating currency
More than once I have to validate user input and more than once that input is a currency value. The currency symbols are not part of the expressions here.
For en-US or en-CA:
^(\d{1,3})(,\d{3})*(\.\d{2})?$
fr-CA currency formatting regular expression:
^(\d{1,3})(\s{1}\d{3})*(,\d{2})?$
Ttyl!
2 Comments:
Hi,
Found this post while searching for a currency regex to help with my cms project - and your's works instantly! Thanks!
Glad it helped. You're welcome...
Post a Comment
<< Home