I'm trying to make regex in JavaScript that matches numbers between 1-100 and includes two decimals. Example numbers that need to be included in the regex:
1
1.1
1.15
0.5
100
100.00
Example numbers that need to be excluded:
101
100.01
100.1
55.999
This is my regex at the moment:
^(?:100(?:\.00?)?|\d?\d(?:\.\d\d?)?)$
This works otherwise but I also need to include two numbers followed by a decimal or 100 followed by a decimal like this:
14.
9.
100.
This is because I'm running the regex check each time a button is pressed in an input field and even though number like 0.5 is allowed by the current regex, I can't type it in because 0. is not allowed.