Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

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

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 - 2 days ago (Last modified 2 days ago)