First of all, I would recommend do not do this. As yahoo does offer a Premium PAID service ( I am using that myself and would be annoyed a lot If you did not allow me to register).
Also you would need to implement on both client (JS) and Server (PHP, ASP.net or whatever you are using), as I could easily disable Javascript, and your check would not be executed then.
But if you know what you are doing and want it done properly, Look for first '@' then the following '.' and get the string between them.
Code:
// get index of '@'
var index_at = email.indexOf('@');
// get index of the '.' following the '@' and use it to get the real domain name
var domain = email.substring(index_at + 1, email.indexOf('.', idx));
// now use the domain to filter the mail providers you do not like
Code to check all sub-domains (for [email protected]) :
// get the string after '@'
var after_at = email.substring(email.indexOf('@') + 1);
// get all parts split on '.', so for [email protected] you can check both x and y
var dot_split = after_at.split('.');
for(var i = 0; i < dot_split.length; i++)
// check each dot_split[i] here for forbidden domains
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…