New to regex syntax here. Trying to write a regex to provide some input validation.
What I need is a regex to match a whole number, or a decimal with exactly one digit past the decimal.
Good Match
1
12
100
1.1
100.1
1.0
No Match
1.22
1.
0
012
Here is what I came up with but it doesn’t work:
Regex.IsMatch(paidHours, "\\d+[.]?[0-9]?")
Edited answer after OP question edit.
Explanation:
Please note that
\dis not exactly equivalent to[0-9]:\dmatches any unicode digit. For instance, this character௮will be matched if you use\dbut won’t be if you use[0-9].