
Andrew McGlashan writes:
This might get you going: A Perl Extensible Mail Filter --> http://marginalhacks.com/Hacks/pemf/
I didn't notice at first either, but he hid a "C library" constraint in the Subject. I can't recommend a library, but I *can* tell you that email addresses aren't regular, so a regular expression is wrong. Observe: foo(@example(.net))@example.org ==> foo@example.org You need a CFG because comment nesting implies context. I don't have an EBNF handy, the RFC probably includes one. I had a quick look, but I can't see a C library that *just* parses email in apt. You probably need one that parses (say) message/rfc822 in general, and just use the address parsing function. PS: for perl, libemail-address-perl (Email::Address) is the thing.