Regular Expression for Integer greater than 0 and less than 11
c#, regex
Solution
You need to modify your regex only a little bit
@"^[1-9]$|^10$"
You don't need the square brackets around single characters and I would use a group around the alternation and change it to
@"^([1-9]|10)$"
See it here on Regexr
Problem
I am trying to modify this Regex so that you get numbers greater or equals 1 or less than or equals to 10. This Regex allows >= 0 or <= 10. I have a text field on a form that takes numbers equals or greater than 0 and less than 11. I could use IF's and logical operators, TryParse but I kinda like the Regex. ``` @"^\d$|^[1][0]$" ```