I am trying to write a regular expression for accepting positive numbers from 1-99 and accepting decimals up to 2 places
I have written this expression
([1-9]|[1-9][0-9])(.[0-9]{1,2})?
But when I tested the expression, it accepted 100 and decimals up to 3 places, while I wanted decimals only up to 2 places and 100 should not be accepted.
This seems to work for me:
As David said, you need to escape your
., or it matches any character, including a digit.