Click here to Skip to main content
15,662,782 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello friends,
I want regular expression for validating input between -100 to 100 only

Input like 99.99 and -99.99 and 0 too

Currently i used :

Above reg-ex will allow 0 to 100 decimal up to 2 digit.

Please Help Me ASAP

Thanks in Advance..
Bernhard Hiller 26-Aug-14 9:24am    
ehm, how did you create that regex above? And why do you not see how to add the '-' at first position?

1 solution

With 2 digits, it's not -100 to 100, it's -99 to -99. The solution: allow 1 to 2 digits and, before digits, 0 to 1 '-'.
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