validating an email address in javascript code example
Example: email regex javascript
/* Answer to: "email regex javascript" */
ValidateEmail("[email protected]"); // Must be a string
function ValidateEmail(email) {
var emailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(String(email).toLowerCase());
if (email.match(emailformat)) {
alert("Nice Email!")
return true;
};
alert("That's not an email?!")
return (false);
};