^(?=\d*(\.\d{1,3})?$)(?=.*
Main Topics
Browse All TopicsI need to update my regular expression so it has the following:
* Accepts all positive decimal values (currently only accepts values greater and equal to one (1))
* i.e accepts ---> 0.0001
* Can have maximum 3 decimal places.
* Decimal places are optional.
This regular expression will be used to validate currency input.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I'm just confused. You said that "Can have maximum 3 decimal places", but why accepts 0.0001. It's 4 decimal places. To accept it (4 decimal), just use ozo's regex but change from \d{1,3} to \d{1,4}
Here output of code below (I modified the regex a bit from ozo)
[123] = 123 (True) parse = success
[ 123 ] = 123 (True) parse = success
[01.1234] = 1.1234 (True) parse = success
[1.1234] = 1.1234 (True) parse = success
[-1.123] = -1.123 (False) parse = success
[-0.0] = 0.0 (False) parse = success
[0.0] = 0.0 (True) parse = success
[00.0] = 0.0 (True) parse = success
[.0001] = 0.0001 (True) parse = success
[0.0001] = 0.0001 (True) parse = success
[a0.0001] = # (False) parse = failed
[ ] = # (False) parse = failed
After deeply dig, I found that it's limitation of javascript function (RegularExpressionValidato
The first group of matching result must equal to the whole value of the element, and the only one I can get now is
ValidationExpression="^\s*
which is not cover all valid decimal values e.g. .0001 (but accept 0.0001). I think, this is acceptable.
Business Accounts
Answer for Membership
by: gnoonPosted on 2008-01-05 at 21:16:39ID: 20592686
^[1-9]\d*(\.\d{1,3})?$