In Javascript I'm trying exclude a specific mail domain and all its subdomains using regex. If the domain I want to exclude is spammail.com. I need to exclude all the following
[email protected]
[email protected]
[email protected]
...
In Javascript I'm trying exclude a specific mail domain and all its subdomains using regex. If the domain I want to exclude is spammail.com. I need to exclude all the following
[email protected]
[email protected]
[email protected]
...
Try like this:
let checkValid = (mail) => !/([^\@]*\@)(([^\.]*\.{1})*)(spammail\.com)/.test(mail);
console.log(checkValid("[email protected]")) //false
console.log(checkValid("[email protected]")) //false
console.log(checkValid("[email protected]")) //false
console.log(checkValid("[email protected]")) //true
console.log(checkValid("[email protected]")) //true