Javascript Regular Expression for International Phone Number

前端 未结 4 1515
有刺的猬
有刺的猬 2021-02-06 17:05

The following regular expression isn\'t working for international phone numbers that can allow up to 15 digits:

^[a-zA-Z0-9-().\\s]{10,15}$

W

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-06 18:06

    and then counts if there are at least 7 digits (minimum length for a valid local number).

    The shortest local numbers anywhere in the world are only two or three digits long.

    There are many countries without area codes.

    There are several well-known places with a 3 digit country code and 4 digit local numbers.

    It may be prudent to drop your limit to 6 or 5; just in case.

提交回复
热议问题