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.
我需要一个避免所有零的正则表达式,包括hypen。下面是图案
000-000-0000
我想避免输入上述数字,除了任何形式的组合都可以。
例子
001-000-0000 000-008-0000 000-000-5000
在这里,我为自己的查询找到了解决方案。
避免 000-000-0000 模式的正则表达式如下
"^(?![0]{3}[-]{1}[0]{3}[-]{1}[0]{4}).*$"
谢谢
在 Python 3 中,我可以执行以下操作(另请参阅PEP3132 on Extended Iterable Unpacking):
a, *b = (1, 2, 3) # a = 1; b = (2, 3)