Rajnikanth Rajnikanth - 1 year ago 97
Javascript Question

Javascript regular expression for currency format

I have this regular expression


With my sample data:

100.00 - Not working :(
1,000.00 - Working
100,000.00 - Working
1,000,000.00 - Working

Note: I need to give error if result is 0.00

Any ideas or suggestions? Thanks.

Answer Source

You could perhaps use:


See how it's working here.

Additionally, if you'd like to forbid leading zeros the regex would be:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download