Javascript String validateEmail()

Description

Javascript String validateEmail()


String.prototype.validateEmail = function() { 
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

    return re.test(this);
};

Javascript String validateEmail()

String.prototype.validateEmail = function () {
    var re=/^[a-zA-Z_0-9]+@[a-zA-Z_0-9]+\.[a-zA-Z_0-9]+$/;
    return re.test(this);
};



PreviousNext

Related