Validate Email using regex - Node.js Regular expression

Node.js examples for Regular expression:Validation

Description

Validate Email using regex

Demo Code

Validator.validateEmail = function(email) {
    var exp = /^([a-zA-Z0-9_\.\-]+)@([\da-zA-Z\.\-]+)\.([a-zA-Z\.]{2,6})$/;
    if (email.match(exp)) {
        return true;
    } else {/*from  w w w.  j a  v  a 2 s  .  c om*/
        return false;
    }
};

Related Tutorials