Validate And Filter Email Address With Regex?
What's the best way to disallow free email service emails (e.g. Gmail, Yahoo, Hotmail) using RegEx and Javascript email field validation? ^.*@(?!(aol\.com$|yahoo\.com$|hotmail\.com
Solution 1:
One of thousands of acceptable ways to get there - not that yours isn't acceptable...
function isGoodEmail(email) {
if(isValidEmail(email)) {
if(/(aol|gmail|yahoo|hotmail)\.com$/.test(email)) {
alert(' valid email, but not for this site. No free service emails!');
return false;
}
return true;
}
return false;
}
function isValidEmail(email) {
// implement using any of the email regexp's available
}
Post a Comment for "Validate And Filter Email Address With Regex?"