Is String email via regex - Node.js Regular expression

Node.js examples for Regular expression:Email

Description

Is String email via regex

Demo Code

/**//from  www . ja v  a 2s  .  c  o m
 * Prototype
 */
String.prototype.isMail = function() {
    var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
    return reg.test(this.toString());
};

Related Tutorials