I want to modify my existing Regular Expression which accepts decimals from 0 to 99.99
\d{0,2}(\.\d{1,2})?$
i want this to be accept
100
100.0
100.00
and should not accept
100.1
100.02
101
Can anyone help me modify the above RE
I guess it's best to add the test for 100 as a special case using |
:
^(\d{0,2}(\.\d{1,2})?|100(\.00?)?)$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With