Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图只接受不以 0 或 1 开头的 7 位长数字
7089097 - 好的
0089097 - 不好
1089097 - 不好
这是我尝试过的:
^\[2-9][0-9]{7}$
而且不工作:)
此正则表达式将起作用:
^[2-9][0-9]{6}$
在 7 位数字中,1 位被第一个位置消耗2-9,然后接下来的 6 位数字可以来自0-9
2-9
0-9
你可以试试这个: