//if HTML5 input email input is not supported
if(type == 'email'){
if(!Modernizr.inputtypes.email){
var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@([a-zA-Z0-9\-])+\.+([a-zA-Z0-9]{2,4})+$/;
if( !emailRegEx.test(value) ){
this.focus();
formok = false;
errors.push(errorMessages.email + nameUC);
return false;
}
}
}
This is my javascript regex for checking if e-mail format is correct. But When I try it myself it shows no error for any ..@.. It does not check .com or whatever in the end. What am I doing wrong?
+
would be perfectly valid in the local part of the email address. It also fails on IDNs. – ThiefMaster♦ Apr 29 '12 at 10:51