Link to home
Start Free TrialLog in
Avatar of -Dman100-
-Dman100-Flag for United States of America

asked on

validating currency input beyond hunderdth

I have a jquery function that validates a value in US currency format.

j$.validator.addMethod("money", function(value, element) {
         return this.optional(element) || /^(\d{1,3})(\.\d{2})$/.test(value);
}, "Must be in US currency format 0.99");

Open in new window


This works for currency values from 0.01 up to 999.00, but it fails when a value of a thousand or more.  I'm not very good with regular expressions at all.

How can I modify the regex to correctly validate the value to support currency values up to 999,999.00?

Thanks for any help.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of -Dman100-

ASKER

Thank you!