Does anyone know a regular expression to validate MSISDN-format mobile numbers?
I looked into a solution posted at http://charlvn.blogspot.com/2010/06/msisdn-regular-expressions.html but I think that's not a generic solution.
I'm looking for a validation regex that could validate any MSISDN-standard mobile number. http://en.wikipedia.org/wiki/MSISDN
Secondly, I'm looking for the means to check whether a valid MSISDN mobile number is from a specific country, like "31628000000" is a number from the netherlands, because it starts with the netnumber "31".
I'm going to implement the validating part in Python.
Thanks in advance!
This should do -- I'm not sure how much more generic you can get:
/^[1-9][0-9]{10,14}$/
To check a number to belong to a particular country, modify the pattern to preface the country code, and then adjust the remaining digits to match:
/^(873[1-9][0-9]{7,11}|91[1-9][0-9]{8,12})$/ # India
/^46[1-9][0-9]{8,12}$/ # Sweden