Email 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).


Leave a Reply

Your email address will not be published. Required fields are marked *