Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(?:\+[0-9]{1,3}()|[0-9]{6,10}()){2}\1\2$
/

Description

Used for number validation in input forms, when number is required to be in international format. You can adjust the required number length by adjusting this part of regex: {6,10}. The bigged the second number, the longer number will pass the match.

Submitted by Donatas StonĨius - donatas@stoncius.lt - 9 years ago