3个数字的正则表达式,不带000 [英] Regular Expression for 3 digit without 000
本文介绍了3个数字的正则表达式,不带000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Google表单上写一个正则表达式
I want to write a regular expression on Google Form
1到9之间的第一个字符 第二和第三个字母(大写) 并且接下来的3个字符应为数字,例如541或001,但不能为000
First Character between 1 to 9 Second and Third any alphabets (Upper Case) and next 3 characters should be number like 541 or 001 but not 000
此表达式也取000
[1-9][A-Z]{2}[0-9]{3}
推荐答案
使用替代方法:
[1-9][A-Z]{2}([1-9][0-9][0-9]|[0-9][1-9][0-9]|[0-9][0-9][1-9])
请参见 regex演示
在这里
-
[1-9]
-从1
到9
匹配1个数字
-
[A-Z]{2}
-两个大写ASCII字母 -
([1-9][0-9][0-9]|[0-9][1-9][0-9]|[0-9][0-9][1-9])
-3个替代方法:-
[1-9][0-9][0-9]
-以1
开头的3位数字
-
[0-9][1-9][0-9]
-中间是1
的3位数字 -
[0-9][0-9][1-9]
-以1
结尾的3位数字
[1-9]
- matches 1 digit from1
to9
[A-Z]{2}
- two uppercase ASCII letters([1-9][0-9][0-9]|[0-9][1-9][0-9]|[0-9][0-9][1-9])
- 3 alternatives:[1-9][0-9][0-9]
- 3-digit numbers starting with1
[0-9][1-9][0-9]
- 3-digit numbers having1
in the middle[0-9][0-9][1-9]
- 3-digit numbers ending with1
此外,请参见此regex演示.
这篇关于3个数字的正则表达式,不带000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
-
查看全文