regex - Regular Expression to accept all the decimals from 0 to 100 -


i want modify existing regular expression accepts decimals 0 99.99

\d{0,2}(\.\d{1,2})?$ 

i want accept

100 100.0 100.00 

and should not accept

100.1 100.02 101 

can me modify above re

i guess it's best add test 100 special case using |:

^(\d{0,2}(\.\d{1,2})?|100(\.00?)?)$ 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -