Just remember that different parts of the world have different numbers of digits for the country code (between 1 and 3) , area code (between 1 and 6), phone number (between 3 and 8) and extension (between 0 and 6).
The lengths may vary more than that but I know of places where the lengths vary at least that much from the standard two digit country code, one digit area code and eight digit phone numbers that we use here.
Also remember people can present their number in various styles. In the UK for example we could have 0044 1283 xxxxxx, 01283xxxxxx, +44(0)1283 xxx xxx all for the same number. I have some code I used to convert all to the same style, but that isn't the answer to your question. I don't think that there is one to cater for all countries.