Skip to content

Issue in validating isMobilePhone() with 'en-US' options. #1195

Open
@Madhavi96

Description

@Madhavi96

The regular expression used for this validation is /^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/.

In common US phone validation web sites, the following condition is checked for US phone number validations.

  1. The area code (first 3 digits) cannot be the same digit

But the above mentioned regular expression does not satisfy the first condition.
For example, if we validate the number 2225550135 using the isMobilePhone() method, it results in a true. But the first 3 digits of the phone number(area code) are similar, thus the web site https://www.textmagic.com/free-tools/phone-validator gives a false.

Due to this reason, this validation could not be used for the project I was working on recently.
Is this an issue in the library? If so, I'm willing to raise a PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions