
7 Oct
2013
7 Oct
'13
11:16 p.m.
Graeme Cross <gcross@fastmail.fm> writes:
I can't recommend a library, but I *can* tell you that email addresses aren't regular, so a regular expression is wrong.
Jeffrey Friedl's book "Mastering Regular Expressions" (O'Reilly) has an RFC 822 compliant regular expression in it that is meant to be very robust.
I do not believe that is possible. AFAICT, this ABNF snippet from RFC 5322 (p12) is irregular: ccontent = ctext / quoted-pair / comment comment = "(" *([FWS] ccontent) [FWS] ")" I glanced at RFC 822 (which is obsolete); it also has a comment nonterminal, although it's not so obviously recursive.