Email Validation RegExp

I had to search my desktop files and email history for forty minutes before I turned this up:

var rfc2822 =
/^[\w!#$%&'*+/=?^`{|}~-]+(?:\.[\w!#$%&'*+/=?^`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])*)+\.(?:[a-z]{2,4}|museum|travel)$/i;


That’s a JavaScript variable declaration, but the RegExp is valid for Perl and can be quickly translated for other languages.

About pyrolupus

Writer, father, teacher, programmer, performer. And I make some mean pancakes, too.
This entry was posted in JavaScript, Regular Expressions. Bookmark the permalink.

One Response to Email Validation RegExp

  1. pyrolupus says:

    For anyone following along, I missed a plus sign in there. Fixed, now.

    Pyro