Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validate South Africa Cell Phone Number

Tags:

php

How can I validate a South African cell phone number? The number must start with the country code like +27 and be max 11 digits long - total 12 with the "+" sign.

like image 564
Lennie Avatar asked Oct 30 '10 09:10

Lennie


1 Answers

The OP was for a South African cell phone (mobile) number not just any South African telephone number.

The following regex is what worked for me:

^(\+27|0)[6-8][0-9]{8}$
  • Allow for international dialling code or starting with zero.
  • South African cell numbers start with 08 or 07 or 06.
like image 200
Duncanmoo Avatar answered Nov 16 '22 02:11

Duncanmoo