Regular Expressions 101

Community Library Entry

52

Regular Expression
PCRE (PHP <7.3)

/
^(?'Username'[-\w\d\.]+?)(?:\s+at\s+|\s*@\s*|\s*(?:[\[\]@]){3}\s*)(?'Domain'[-\w\d\.]*?)\s*(?:dot|\.|(?:[\[\]dot\.]){3,5})\s*(?'TLD'\w+)$
/
gm

Description

Matches distorted email addresses and converts them back to real ones.

Submitted by dislick - 12 years ago