Regular Expressions 101

Community Patterns

Your search did not match anything

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^\+?(\d+)?[ \.-]*\(?(\d{3}){1}\)?[ \.-]*(\d{3}){1}[ \.-]*(\d{4}){1}(?:[ ,]*)(?:e?x[tension\.: #]+|opt[ion:\. ]+|#)?(\d+[ ,#]*)?$
/
gmi

Description

Search string for use in contact cleaning project $1 = intenational code, omitting preceding "+" $2 = area code $3 = first three digits of phone number $4 = last four digits of phone $5 = extension, inclusive of any commas or hashes to automate phone tree navigation TO DO handle recursive menus (e.g., "321-321-1234,,,1234#,,123344#....)

Submitted by Jason - a month ago