Validate Email Format with regex - Node.js Regular expression

Node.js examples for Regular expression:Email

Description

Validate Email Format with regex

Demo Code


function validateEmailFormat(email){
  var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');

  if(reg.test(email))
  {/*from  w w w . j a  va  2 s .  com*/
    return(true);
  }
  else
  {
    return(false);
  }
}

Related Tutorials