DrHyde / perl-modules-Number-Phone

Number::Phone and friends
24 stars 32 forks source link

Expose libphonenumber IDD prefix regular expressions #89

Closed mikeraynham closed 6 years ago

mikeraynham commented 6 years ago

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.

coveralls commented 6 years ago

Coverage Status

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

DrHyde commented 6 years ago

thanks, merged

DrHyde commented 6 years ago

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

mikeraynham commented 6 years ago

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