US Phone Number Verification

前端 未结 13 1795
眼角桃花
眼角桃花 2020-11-30 14:00

I have a website form that requires a US phone number input for follow up purposes, and this is very necessary in this case. I want try to eliminate users entering junk data

13条回答
  •  孤街浪徒
    2020-11-30 14:56

    For US and International Phone validation I found this code the most suitable:

    ((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$
    

    You can find an (albeit somewhat dated) discussion here.

提交回复
热议问题