How to put a number greater than 9 to regexp character set?
For example, I can do ^[01236]$
, but what if I want to put 100
as an option to the set?
How do I solve this problem?
How to put a number greater than 9 to regexp character set?
For example, I can do ^[01236]$
, but what if I want to put 100
as an option to the set?
How do I solve this problem?
If a number is greater than 9, it is more than 2 digits and the first digit is not 0. So the regex you might want to use is: ^[1-9][0-9]+$
If you want to put a specific multi character strings you can use:
^(10|100|200|301|601)$
Which will match 10
, 100
, 200
, 301
, and 601