Javascript: Email Validator
Problem: email should allow +/- characters in user, - in domain.
dash (-) should be allowed anywhere in an email address or domain.
plus (+) is allowed in the username (many people use this for categorization, especially at gmail)
Solution :
var regex = new RegExp("^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})$","i");
This will validated also emails like: username1+username2@gmail-domain.co.uk
October 3, 2008 | Filed Under javascript | Leave a Comment