how to check email for @ javascript code example
Example 1: email regex javascript
/* JavaScript: validating email address */
isValidEmail("[email protected]"); // true
function isValidEmail(email) {
var emailRegex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
return !!email && typeof email === 'string'
&& email.match(emailformat)};
};
Example 2: code for email verification in front end using javascript
function validateEmail(email) {
const 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(String(email).toLowerCase());
}