Community Patterns

Community Library Entry

0

Regular Expression
Created·2015-07-05 09:37
Flavor·Python

r"
^(?P<Username>[-\w\.]+)(?:\s+\W*at\W*\s+|\s*[^\@\s]*?@[^\@\s]*?\s*)(?P<Domain>([\w\-]+)(?:(?:\.|\s+\W*?dot\W*?\s+)([\w\-]+))+?(?:(?:\.|\s+\W*?dot\W*?\s+)([\w\-]+))??$)
"
gm
Open regex in editor

Description

Parses email, also distorted ones, and convert them back to the real ones. It can recognize at maximum two dots notations, just add '.\5' at the end of the substitution string. Inspirated by dislick's work: https://regex101.com/r/wB7xJ7/1

Submitted by fine_dust