Click here to Skip to main content
16,012,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I need a regular field expression which should allow only whole number and decimal number example I can allow the user to enter values like 5,0.5 and not 0.25 or 0.75
how to do it
Posted
Comments
jai000 1-Feb-12 1:06am    
Are you working on windows based application?

This will do
CSS
^\d*\.?\d*$ ^\d*\.?\d*$ 
 
Share this answer
 
Try ^(?:[-+]?[1-9]\d*|0)?(?:\.\d+)?$.
 
Share this answer
 

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