Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
1.20/5 (3 votes)
See more:
I need a regular expression that checks a numeric value to ensure it has two decimal places after the ".".

eg. 0.01, 0.10 is OK, but 2.0 or 0.1 is not OK.

It's for use with currency. However, I don't need to worry about the $ sign.
Posted
Updated 2-Feb-12 7:23am
v2

1 solution

Try this:

/\d*\.\d{2}/

I rephrased your question so I hope this is what you were after/
 
Share this answer
 
Comments
cutexxbaby 2-Feb-12 13:32pm    
but i try the expression you give, however , it give me dont allow me 0.01, 0.10 is which i want it to be OK

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900