I've written an ereg for validating an email. It works fine, but I keep wondering if I've covered all (or as many as possible) of the bases. This is my ereg:
if(!ereg("^([a-zA-Z0-9_\-\.]+)@(([a-zA-Z0-9_\-]+\.)+)(([a-zA-Z]{2,4})|([a-zA-Z]{6}))$",
$email_field))
{
//error message
}
I'd be interested if anyone thinks I've missed something important, or even better, if someone can point me to a place that gives the syntax for valid emails, for example, can an email start with a number? Can the string after the @ have a hyphen or an underscore?
Thanks.