regular expressions javascript email code example
Example 1: how to validate an email address in javascript
function validateEmail(email)
{
var re = /\S+@\S+\.\S+/;
return re.test(email);
}
console.log(validateEmail('[email protected]'));
Example 2: regex pattern to validate email
[a-zA-Z0-9._-]{3,}@[a-zA-Z0-9.-]{3,}\.[a-zA-Z]{2,4}