regexvalidationphone-numberclickatell

RegEx for valid international mobile phone number


I use Clickatell to send SMSes to clients' mobile phones.

Is there a standardised regular expression for all valid mobile phone numbers, e.g. +27 123 4567? I'd roll my own, but I'm worried about missing an obscure, valid phone number format.


Solution

  • After stripping all characters except '+' and digits from your input, this should do it:

    ^\+[1-9]{1}[0-9]{3,14}$
    

    If you want to be more exact with the country codes see this question on List of phone number country codes

    However, I would try to be not too strict with my validation. Users get very frustrated if they are told their valid numbers are not acceptable.