Phone validation regex

后端 未结 16 1548
孤城傲影
孤城傲影 2020-11-27 02:56

I\'m using this pattern to check the validation of a phone number

^[0-9\\-\\+]{9,15}$

It\'s works for 0771234567 and +0

16条回答
  •  我在风中等你
    2020-11-27 03:54

    ^+?\d{3}-?\d{2}-?\d{2}-?\d{3}$
    

    You may try this....

    How about this one....Hope this helps...

    ^(\\+?)\d{3,3}-?\d{2,2}-?\d{2,2}-?\d{3,3}$
    

提交回复
热议问题