Validate phone number with JavaScript

前端 未结 26 2272

I found this code in some website, and it works perfectly. It validates that the phone number is in one of these formats:
(123) 456-7890 or 123-

26条回答
  •  逝去的感伤
    2020-11-22 05:20

    Simple Regular expression: /\b\d{3}[-.]?\d{3}[-.]?\d{4}\b/g

    Check out the format, hope it works :
    444-555-1234
    f:246.555.8888
    m:1235554567

提交回复
热议问题