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.
Coverage increased (+6.0e-05%) to 99.936% when pulling f579c69038871929101d3dff8cae7c15ca7d9372 on mikeraynham:idd_regex into 9975a604c29d636424340dc3d004f165886e8723 on DrHyde:master.
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.