正则表达式数字小于82(Regex digits smaller then 82)
我试图写一个简单的正则表达式,但我不知道为什么它不起作用。
用户输入2位数字,如01 ,直到82 。 82系统会拒绝。
这是我的正则表达式,2位数字必须小于82。
0[1-9]|[1-8][0-9]|8[0-2]I'm trying to write a simple regex but I don't know why it is not working.
User enter 2 digits number like 01, 09, 23, 55, until 82. After 82 system will refuse.
Here is my regex, 2 digits must be smaller than 82.
0[1-9]|[1-8][0-9]|8[0-2]最满意答案
你应该有[1-7]范围10-79,而不是[1-8] 。 不要忘记^和$来指定字符串的开始和结束:
^(0[1-9]|[1-7]\d|8[0-2])$You should have [1-7] for the range 10-79, not [1-8]. Don't forget the ^ and $ to specify the start and ending of the string:
^(0[1-9]|[1-7]\d|8[0-2])$更多推荐
发布评论