Community Patterns

Community Library Entry

1

Regular Expression
Created·2023-10-25 08:48
Flavor·PCRE2 (PHP)

/
(?<phone>(\+?\d{1,4}?[-.\s]?)?(\(\d{1,4}?\))?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9})|(?<email>[\w\-][\w\-\.]+@[\w\-][\w\-\.]+[a-zA-Z]{1,4})
/
gi
Open regex in editor

Description

Extract the phone numbers and email addresses from a string

Submitted by Mukesh Jangid