Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(8|\+7)(\s|\(|-)?(\d{3})(\s|\)|-)?(\d{3})(\s|-)?(\d{2})(\s|-)?(\d{2})$
/
gm

Description

A regular expression for searching for phone numbers in the Russian format, taking into account different ways of writing the number, including spaces, brackets and dashes.

Регулярное выражение для поиска номеров телефонов Российского формата. Учитывает написание номера через пробел, скобки, тире и без таковых

Submitted by https://t.me/ds_ivanov - a month ago