问题
I'm trying to make this Regex allow this symbol -
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]$
回答1:
How about this one?
([+]*\d{3,})*\s?\d{3}[-]?\d{6}
- Optional plus sign
- Optional space (between country code and the rest)
- Optional dash
Update
\+\d{3}[ ]?(\d+(-| )?)+
- Expect plus sign.
- Expect 3 digit number (country code).
- Optional whitespace.
- Any number of digits followed by an optional dash OR a whitespace
- Repeat the previous step for 1 or more times.
来源:https://stackoverflow.com/questions/65076894/whatsapp-phone-number-regex