Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
PCRE (PHP <7.3)

/
^(00989|\+989|09)(\d{9})$
/
gm

Description

Persian Mobile Number Matching

Iran's international phone code is +98 and sometimes people use 0098. All mobile numbers starts with 9 after the code.

So this pattern matches exactly a sequence of characters which starts with one of +989, 0098 or 09 prefixes and total count of characters after these prefixes is exact 9.

Submitted by anonymous - 4 years ago