Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^\+20(10|11|12|15)[0-9]{8}$
/
gm

Description

This regular expression is designed to validate Egyptian mobile phone numbers by ensuring they conform to the following format:

Country Code: The number must start with +20, representing Egypt's international dialing code. Mobile Networks: (Vodafone: 10, e&:11, Orange:12, we:15) Operator Code: The phone number must be followed by one of the valid operator prefixes (10, 11, 12, or 15), corresponding to major mobile networks in Egypt.

Number Length: The phone number must have exactly 8 digits following the operator code, for a total of 11 digits (including the country code and operator code).

This regex is commonly used to ensure that the input phone numbers follow the standard Egyptian format and belong to the correct mobile operators.

Submitted by Mohamed Amir - 6 days ago