Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(?:8|\+7|7)?[-\s\(]*(?<kod>\d{3,4})?[-\s\)]*(?<phone>[\d-]{7,10})(?:[\D]+(?<dob>\d+))?\D*$
/
sgm

Description

Here is a pattern for all kind of Moscow and Moscow Region phones with or without additional number.

Submitted by cvvvlad - 8 years ago