Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^\+597[78]\d{6}$
/
gm

Description

So the regular expression ensures that the phone number starts with "+597", followed by either a 7 or 8, and then six more digits. This will match all three phone numbers you provided as examples.

Submitted by Kenny - 2 years ago