I need to only accept input as numerical values 0 to 100, integers and floats with max two decimal places inclusive, and write a regular expression to check these conditions.
For example, I want it to accept values such as:
0(min), 0.1, 1, 11, 11.1, 11.11, 100(max).
But not any of:
-1, 100.1, 111, 1+1, .1, etc.
So far I came up with ^\d?\d+(\.\d\d?)?$ except that it has a bunch of problems.
Just now while submitting this, I saw this link in similar questions sidebar that has what seems to be the solution ( "^((?:|0|[1-9]\d?|100)(?:\.\d{1,2})?)$" ), except that it also accepts 100.01 to 100.99. Other than that, which is a very minor issue, it should work.
But does anybody know how to patch that particular bit?