Phone validation regex

后端 未结 16 1520
孤城傲影
孤城傲影 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:48

    ^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$
    

    Matches the following cases:

    123-456-7890

    (123) 456-7890

    123 456 7890

    123.456.7890

    +91 (123) 456-7890

提交回复
热议问题