Well, there are several different computer languages out there ๐ and believe it or not, many of them use different types of regexps. Now, I'm just guessing, after looking briefly at yours, and checking the site (which happened to be called what, ASPsmith? what the H**k is ASP :rolleyes: ) that the one you picked up has some little something that isn't quite right for PHP. I believe that PHP uses PCRE (Perl-Compatible-Regular-Expressions) as well as some form of POSIX compatible ones, but I'm not sure. Check the handbook to be sure.
Here's my email check:
function ValidateInput($var, $type) {
trim($var);
if ($type=="email") { $Pattern = "^([0-9a-z]+)([0-9a-z\._-]+)@([0-9a-z\._-]+)\.([0-9a-z]+)"; }
elseif ($type=="phone") { $Pattern = "^([0-9]{3})-([0-9]{3})-([0-9]{4})"; }
$valid=ereg($Pattern, $var);
return $valid;
} # end of Function
I bet it'll work for you, although I'm sure someone else can come up with something different, maybe even better....
HTH,