Community Patterns

Community Library Entry

1

Regular Expression
Created·2024-11-29 10:29
Updated·2024-12-05 08:36
Flavor·PCRE2 (PHP)

/
(?:(?<display>[^<>\n]+)<)?(?<local>(?:[^\n \x22,\.:;<>@\[\\\]]{1,64}|[^\n \x22,.:;<>@\[\\\]]{1,32}\.[^\n \x22,.:;<>@\[\\\]]{1,32}|\x22[^\n]{1,62}\x22))@(?<domain>[\w.]+(?:\.\w{1,4})?|\[(?:IPv6)?[\da-fA-F.:]+\])>?
/
gm
Open regex in editor

Description

this will run in any flavor but python in regex101.

based on wikipedia

bugs: local part can have more than 64 chars if we abuse . or other things

Submitted by fbd_1