I am receiving phone numbers from a mobile device, format varies from international format or not.
Scenario (ZA formats just for the example) :
Registered numbers in database are always international format : +27827177982
Numbers I receive can vary e.g. +27827177982
= 27827177982
= 0827177982
- international prefix for number is +27
How do I match it to the international format even though I don't receive the international format???
Keep in mind :
I can't do conversion just for 1 region.
Is there a simple way of comparing mobile phone numbers for all regions?
Prefixes ranges in amount of chars reference : http://en.wikipedia.org/wiki/List_of_country_calling_codes
My ideas :
Compare the last 9 characters of the number, this will rule out the region prefix... but does every region only have '9 characters excluding the prefix'?
Loop through the database comparing the phone numbers a couple a times e.g. check for last 9 numbers - if no match - check for last 10 etc. (But can cause unwanted matches)
Any help would greatly be appreciated