Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

ratatatKE commented Jul 10, 2016

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

@ngugijames

This comment has been minimized.

Copy link

ngugijames commented Jul 13, 2016

Asante 👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.