regular expression test validation after complete mail entered code example
Example 1: 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);
};
Example 2: email validation regex
python
r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"