by pierrec · 8y ago · 0 comments
No matter what language or programming style you use it's going to be ugly because it's an ugly problem.
In the case of perl, where regexps performance has been optimized for significantly, the regexp actually performs better than a more normal parser.
From http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html:
> It provides the same functionality as RFC::RFC822::Address, but uses Perl regular expressions rather that the Parse::RecDescent parser. This means that the module is much faster to load as it does not need to compile the grammar on startup.
Of course, if perl were a statically compiled language, the cost of compiling the grammar could be done at compile time.
https://blog.onyxbits.de/validating-email-addresses-with-a-r...