Im using the code below to validate email. i want to change the code and use the eregi -- case insensitive regular expression match, and also to use the $ at end to signify end of string,but not sure what changes need to made. i have read up on php.net bout it but still confused after having tried to change it i encountered errors. Plz help. It is from function mail_check($val) that i need to change it.
<?
function err()
{
global $errorList;
echo "<b>The following errors have ocurred: <b><br>";
echo "<ul>";
for ($x=0; $x<count($errorList); $x++)
{
echo "<li>$errorList[$x]";
}
echo "</ul>";
echo "Go <a href=javascript:history.back();>back</a> to correct them? ";
}
function mail_check($val)
{
$pmat = "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/";
if(preg_match($pmat, $val))
{
return 0;
}
else
{
return 1;
}
}
?>