Click here to Skip to main content
15,879,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Could any body help me on getting regular expression for the following number
0.009

conditions:

start digit is always 0 or .
after . only 3digits should be allowed.


Sincerely,
Pawan.
Posted
Comments
Sandeep Mewara 24-Jul-10 3:40am    
Why don't you learn making Regex? We provided you sites to check/verify Regex, yet you keep asking Regex. You should try yourself first.

Sounds pretty trivial. There's a program called Expresso that people who don't understand regular expressions can download for help building them. Do you want exactly three digits ? If so, you want to specify an optional 0, a mandatory . and then exactly 3 digits.

([0-9]?(\.)[0-9]{3}

Seems like a good first stab.
 
Share this answer
 
Below Expression solves my issue
<pre>([0]?(\.)\d{1,3}) </pre>
 
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