Javascript String checkEmail()

Description

Javascript String checkEmail()



String.prototype.checkEmail = function(){
 var re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ig;
 var success = re.test(this);
 if (success) {// w  w w. j av  a2  s . c  o  m
  document.write("yes");
 }else{
  document.write("not");
 }
}

Javascript String CheckEmail()

String.prototype.CheckEmail = function(){
    var reg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
    return reg.test(this);
};



PreviousNext

Related