email-validate-0.1: Validating an email address string against RFC 5322

Text.Email.Validate

Description

Properly validating e-mail addresses (or converting EBNF to Parsec)

In recent times there have been several calls for websites to properly validate email addresses. Invariably, the compiled regex from Perls RFC822 is pasted up as The Way To Do It. The problem with this is (as the source code from the Perl module notes) is that email addresses cannot be validated by a simple regex (due to requiring parenthesis-matching). The Perl code addresses this by first stripping out all comments and then parsing via regex.

With this in mind, I thought that implementing the Addr-Spec specification from RFC 5322 (only released less than 6 months ago) might be a good test of the Haskell library Parsec. So, without further ado I went ahead and translated the EBNF from RFC 5322 directly into Parsec.

Author: Porges Source: http://porg.es/blog/properly-validating-e-mail-addresses

Synopsis

Documentation

isValid :: String -> BoolSource

Validate an email address encoded in a String satisifes RFC 5322