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.
请任何人帮助我构建一个正则表达式来验证 javascript 中的手机号码。标准是我必须允许 + 符号、- 符号、数字、空格、左大括号(和右大括号(例如:+0 (080) - 90343534554
如果对特殊字符的位置或数量没有限制,则可以使用以下正则表达式:
^[+\-\d\s\(\)]+$
但是根据标准,我建议使用:
^\+?[\d\s]+(\-([\d\s]|[\s]*(\([\d]+\)[\s]*))+)+$