Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i want a regular expression which will allow
following formats :
- 1.00
1.00
-1.00(no space between minus and digits)

i wrote a reg ex as *(-?)\s?\$?([0-9\.]*)
but its not working for - 1.00(with space ) can anyone help me ?
Posted

You can try to find your exact match from this link

http://regexlib.com/[^]
 
Share this answer
 
Regular Expression for your Requirement follows:

^(\-*\s*[0-9]+\.[0-9]+)$

Check this expression by giving several inputs in the following link
http://www.regexplanet.com/advanced/java/index.html[^]
 
Share this answer
 
try this expression

^-?\s?[0-9]{1,}(\.[0-9]{2})?$
 
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