Email address validation in java using regexp

One would think validating an email address is an easy task. Turns out however that is not that trivial, the grammar is quite complex. While many people use regexp to validate email addresses, most of them are way to simple to be able to correctly validate according to the grammar (does it allow + in name? does it check for .. in domain name? and so on)

One regexp which fits the bill quite ok is in the Perl moduleĀ  found at this address: http://ex-parrot.com/~pdw/Mail-RFC822-Address.html which validates against to RFC 822 grammar.

A utility class with the regexp from the perl module can be downloaded from here: EmailAddressUtil

Leave a Comment