What is the regex for any number, float or int, within range of 95 to 106?
95
to106
are acceptable values95.0
and106.0
are valid inputs along with all floats within range95
and106.0
are also valid inputs
What is the regex for any number, float or int, within range of 95 to 106?
95
to 106
are acceptable values95.0
and 106.0
are valid inputs along with all floats within range95
and 106.0
are also valid inputsAssuming that temperatures are representations of integers or floats having a digit after the decimal point, you could use the following regular expression.
The regex engine engine performs the following operations.
\b match a word break
(?<!\.) the following character is not preceded by '.'
(?: begin a non-capture group
(?: begin a non-capture group
9[5-9] match '9' followed by '5', '6', '7', '8' or '9'
| or
10[0-5] match '10' followed by '0', '1', '2', '3', '4' or '5'
) end a non-capture group
(?:\.\d)? optionally match a decimal and one digit
| or
106 match '106'
(\.0)? optionally match '.0'
) end non-capture group
(?!\.) the previous character is not to be followed by '.'
\b match a word break