.oO(patricktr)
> I've picked up a simple e-mail vaildation string from
one of the forums which
>seems to work (most times)...
Proper regex-based email validation is almost impossible. For
an example
see this little pattern, which is still incomplete:
http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
And even if the address appears to be syntactially correct
doesn't mean
that it exists. The only way to be sure is to actually send a
message
and have the user respond.
> I've just hit a problem where it is rejecting an e-mail
address and I can't
>see why.
>
> The vailidation statment is....
>
> if
>(preg_match("/^([a-z0-9]([a-z0-9_-]*\.?[a-z0-9])*)(\+[a-z0-9]+)?@([a-z0-9]([a-z0
>-9-]*[a-z0-9])*\.)*([a-z0-9]([a-z0-9-]*[a-z0-9]+)*)\.[a-z]{2,6}$/",
$address))
> { return true; }
> else
> { return false; }
Such patterns will always reject a lot of valid addresses and
allow many
invalid ones (hint: there are a _lot_ more chars allowed than
just ASCII
letters and digits!). And this pattern doesn't even allow
uppercase ...
If it has to be a regex check, I would simply check for a
single '@' and
some string before and after it.
Micha