[Phpwm] Simple PHP Contact Form
David Goodwin
david at codepoets.co.uk
Wed Oct 14 06:48:23 UTC 2009
>
> if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$",
> $emaila)) error_alert("Invalid Email Address");
My understanding is that there are a million and one regexps to
validate email addresses and it'd not the right one unless it is very,
very long.
Yours will fail on eg adresses which look like foo.o'reilly at ....
(valid) or foo+bar at ... (valid).
And it allows an _ in a domain name which isn't possible. I think
there are also tlds longer than 4 characters.
And ereg is deprecated, as has already been pointed out. Use preg_match
You'd have made the regexp easier to write in ' rather than " -
avoiding \\ escaping blah blah too i think.
Sorry if I sound bitchy,
David
More information about the Phpwm
mailing list