Test, validate and match regular expressions
A fully RFC 5322-compliant email address validator that supports dot-atom and quoted-string local parts, dot-atom domains, bracketed domain literals ([...]), nested comments via subroutine recursion ((?-1)), and folded whitespace (CRLF followed by spaces/tabs) as allowed in mail headers. It uses PCRE2 atomic groups (?>...) and possessive quantifiers (++/*+/?+) throughout to lock in matches and drastically reduce backtracking steps. Anchored with ^...$ in multiline mode, it's suited for strict addr-spec validation in mail parsers and header processing.