Hi i'm new to javascript and I'm trying to check if a new registered user on my site is not using a gmail / hotmail / or a yahoo
Here is what i have tried to check if the mail is not a gmail / hotmail / yahoo. But if the user is using one of them i still get the error and the console log:
example not using a gmail that still gets the error and console log
var testMail = 'testmail@fakemail.com';
var check_email = '[a-zA-Z0-9]{0,}([.]?[a-zA-Z0-9]{1,})[@](gmail.com|hotmail.com|yahoo.com)';
if (!testMail.check_email) {
//errors.push({msg: "You can't use that email to register"});
console.log("You can't use that email to register") // using console.log for testing
}
example using a gmail / hotmail / yahoo:
var testMail = 'testmail@gmail.com';
var check_email = '[a-zA-Z0-9]{0,}([.]?[a-zA-Z0-9]{1,})[@](gmail.com|hotmail.com|yahoo.com)';
if (!testMail.check_email) {
//errors.push({msg: "You can't use that email to register"});
console.log("You can't use that email to register") // using console.log for testing
}