Email RegEx.

By Posted in - Code & Email on November 13th, 2012 regex

So, I have been using ^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$ to validate email addresses. Seems to work well. I found this over at Markus Sipilä’s website. And, in case you weren’t aware, you can use this as a pattern attribute in an <input type=email> tag in an HTML5 form. Much easier than JavaScript validation (though not as fun).

Please leave a Comment...