TBH, its only really worthwhile checking for the existance of the '@' symbol - if someone wants to give a bad email, they really will, evne if it 'should' exist.
Anyway, something like this ought to hold true for any (current) email addresses:
PHP Code:
function legal_email($email)
{
return ( preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $email)) ? True : False;
}
But its not pretty to look at, far simpler to use something like this (ok, it only shows they're trying to give an email, but thats really the best you should hope for)
PHP Code:
function legal_email($email)
{
return (strchr($email, '@') !== False) ? True : False;
}
as to bugs in your function, you don't need commas between a-z,0-9 etc. Beyond that, it may be that POSIX won't work with it [this is not true,
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --