Try this one
^(?:\d{1,2}(?:\.\d{1,2})?|100(?:\.0?0)?)$
See here at Regexr
(?:) do not capture groups, this means that a match from this group is not stored in the variable.
\d{1,2} matches 1 or 2 digits
(?:\.\d{1,2})? This is optional . followed by 1 or two digits
or
100(?:\.0?0)?) Matches 100 and then 1 or 2 0
^ matches start of line
$ matches end of line
These two anchors are necessary, otherwise it will also correspond if there are things before or after the allowable number.
Update: I do not know, but if you want to disable leading zeros and numbers without two digits in the fractional part, try this:
^(?!0\d)(?:\d{1,2}(?:\.\d{2})|100\.00)$
I deleted the optional parts, so there should be a period and two digits after it.
(?!0\d) - this is a negative result, which guarantees that the number does not start with 0 and immediately the next digit.
source share