Well, you would ask for the improbable here.
Just how valid do you want you email validation? I suppose as valid as you can get huh?
Well, you're not really going to find that here, since there is a large level of complexity to REALLY validating an email address.
Here's a link to the real thing by Friedl for perl:
http://examples.oreilly.com/regex/email-opt.txt
now if you'd like a single regex that's good enough, try this:
<?
function goodEmail($emailAddress) {
if (@preg_match("/.+@.+\..+$/", $emailAddress)) {
return true; } else { return false; }
}
?>
As far as testing for knowing if the host is web based....
HA HA HA HA GOOD LUCK!!!
You'll have to determine that your self,
though, this regex could help:
function isWebHost() {
if (@preg_match("/.+@(.+\..+)$/", $emailAddress, $host)) {
foreach ($host[1] as $key=>$val) {
if (preg_match('/hotmail|yahoo|whateversite/i',$val) {
return true;
}
}
}
return false;
}
So there you go