Skip to content

Incorrect country detection for phone numbers with shared prefixes (+1, +7) #85

@nikolaiovchinnikov

Description

@nikolaiovchinnikov

Hi!

When detecting the country based on the phone prefix, there seems to be an issue — for example, numbers from the US and Canada, or Russia and Kazakhstan, are not always detected correctly.

I suspect the problem might be related to this line:

if (leadingDigits != null && nationalNumber.startsWith(leadingDigits)) {

Additionally, there seems to be an issue in the regular expression here:

It doesn’t correctly match numbers like +7705, which should be identified as Kazakhstan, but they might be misclassified or rejected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions