Skip to content

Instantly share code, notes, and snippets.

@muya
Created February 28, 2016 16:06
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save muya/ce5a18a3f119cc4ac286 to your computer and use it in GitHub Desktop.
Save muya/ce5a18a3f119cc4ac286 to your computer and use it in GitHub Desktop.
Regex for Safaricom Kenya, Airtel Kenya & Tigo Tanzania Phone Numbers
# KE
SAFARICOM: "/(\+?254|0|^){1}[-. ]?[7]{1}([0-2]{1}[0-9]{1}|[9]{1}[0-2]{1})[0-9]{6}\z/"
AIRTEL: "/(\+254|0|^){1}[-. ]?[7]{1}([3]{1}[0-9]{1}|[8]{1}[5-9])[0-9]{6}\z/"
# TZ
TIGO: "/(\+?255|0|^){1}[-. ]?([7]{1}[1]{1}[2-9]{1}|[6]{1}[57]{1}[2-9]{1})[0-9]{6}\z/"
@ratatatKE
Copy link

Thanks, this is just what I was looking for.
Do you have the regex to validate Orange Kenya numbers as well?

@ngugijames
Copy link

Asante 👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment