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.
在正则表达式中搜索电话号码,允许强制 10 位数字和 +、()、空格字符,
我尝试了下面的代码,但它不起作用:
"^[0-9]{10,10}[' '+()]$"
尝试 ^[ ()+]*([0-9][ ()+]*){10}$
^[ ()+]*([0-9][ ()+]*){10}$
这将与输入中任何其他位置的任意数量的, (, ),+字符精确匹配 10 位数字。
(
)
+
尝试使用^[0-9\ \(\)\+]{10}$
^[0-9\ \(\)\+]{10}$