Страницы

Показаны сообщения с ярлыком печаль. Показать все сообщения
Показаны сообщения с ярлыком печаль. Показать все сообщения

среда, 6 июня 2012 г.

RegEx makes me cry sometimes :(

Mail::RFC822::Address is a Perl module to validate email addresses according to the RFC 822 grammar. 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.

Download Mail::RFC822::Address-0.4.tar.gz or read the documentation.

The grammar described in RFC 822 is surprisingly complex. Implementing validation with regular expressions somewhat pushes the limits of what it is sensible to do with regular expressions, although Perl copes well: