task: input only numbers from 16 to 100; how can you make a regular expression from 16-100, or can there be any other way?
Regex inputRegex = new Regex(@"^[16-100]$"); //так не работает! task: input only numbers from 16 to 100; how can you make a regular expression from 16-100, or can there be any other way?
Regex inputRegex = new Regex(@"^[16-100]$"); //так не работает! dialects of regular expression engines, of course, may differ.
here is the head-on solution for the extended regular expression:
^(1[6-9]|[2-9][0-9]|100)$ the brackets are limited to three options, the options are separated by characters | :
1[6-9] [2-9][0-9] 100 first option: the character 1 , followed by any of the characters from the range 6-9 .
second option: any of the characters from the range of 2-9 , followed by any of the characters from the range of 0-9 .
third option: just three characters 100 .
Source: https://ru.stackoverflow.com/questions/515287/
All Articles