Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose libphonenumber IDD prefix regular expressions #89

Merged
merged 1 commit into from
Jul 10, 2018

Conversation

mikeraynham
Copy link

@mikeraynham mikeraynham commented Apr 19, 2018

Google's libphonenumber project provides regular expressions for matching IDD prefixes, as well as, in some cases, the preferred or default IDD code for a country. Data for the idd_code() function in Number::Phone::Country is already derived from libphonenumber.

This revision makes the IDD prefix regular expressions available via a new idd_regex() function in Number::Phone::Country, thus making it possible to match telephone numbers against possible IDDs for a given given ISO Alpha-2 country code.

As an example, the regular expression for Australia (AU) will match a number of IDD prefixes, including 0011, 0014, and 0015, making it possible to determine that 001516502530000 could be a US number being dialled from Australia.

idd_regex() might go some way to solving the problem discussed in #39.

Google's libphonenumber project provides regular expressions for matching IDD
prefixes, as well as, in some cases, the preferred or default IDD code for a
country.  Data for the "idd_code()" function in Number::Phone::Country is
already derived from libphonenumber.

This revision makes the IDD prefix regular expressions available via a new
"idd_regex()" function in Number::Phone::Country, thus making it possible to
match telephone numbers against possible IDDs for a given given ISO Alpha-2
country code.
@coveralls
Copy link

Coverage Status

Coverage increased (+6.0e-05%) to 99.936% when pulling f579c69 on mikeraynham:idd_regex into 9975a60 on DrHyde:master.

@DrHyde DrHyde merged commit 39f8a36 into DrHyde:master Jul 10, 2018
@DrHyde
Copy link
Owner

DrHyde commented Jul 10, 2018

thanks, merged

@DrHyde
Copy link
Owner

DrHyde commented Jul 10, 2018

This will be in the next quarterly release, which should be some time in September.

@mikeraynham
Copy link
Author

Thanks for merging this, and sorry for the late response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants