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"); } }
String.prototype.CheckEmail = function(){ var reg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/; return reg.test(this); };