WhatsApp 电话号码 正则表达式 [英] WhatsApp Phone number Regex
本文介绍了WhatsApp 电话号码 正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让这个正则表达式允许这个符号-
I'm trying to make this Regex allow this symbol -
例如此电话号码目前不匹配 +212 659-639217
For Example this Phone Number is not matching right now +212 659-639217
所以我需要有人帮我更改正则表达式以允许它这是正则表达式:
So I need some one to help me change the Regex to allow it please Here is the Regex:
^\+(?:[0-9]\x20?){6,14}[0-9]$
推荐答案
这个怎么样?
([+]*\d{3,})*\s?\d{3}[-]?\d{6}
- 可选加号
- 可选空格(在国家代码和其他代码之间)
- 可选破折号
\+\d{3}[ ]?(\d+(-| )?)+
- 期待加号.
- 需要 3 位数字(国家/地区代码).
- 可选的空格.
- 任意数量的数字后跟可选破折号或空格
- 重复上一步 1 次或多次.
这篇关于WhatsApp 电话号码 正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文