how to check email form in javascript code example
Example 1: email validation in 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: regex pattern to validate email
[a-zA-Z0-9._-]{3,}@[a-zA-Z0-9.-]{3,}\.[a-zA-Z]{2,4}