Is there a regex that would validate a percentage value to 2 decimal places?
I have a regex for two decimal places, but don't know how to stop values above 100. e.g. 100.01 is validated with my regex.
In Perl:
/(^100([.]0{1,2})?)$|(^\d{1,2}([.]\d{1,2})?)$/
or you can just add an extra if comparing 100 exactly :)
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