Example:
cheddar@there.net is valid
cheddar.cheese@mature.net is also valid
cheddar.cheese is not valid
I have found what I thought was a great little expression to do this but when I run it I get the following error@
"Warning: eregi(): REG_ERANGE: in c:\program files\apache group\apache\htdocs\learn\core.php on line 28"
I am verifying the email as follows:
Code: Select all
function is_email_valid($str)
{
// checks to see if a valid email format has been entered
if(eregi('^[ a-z0-9-_]+(.[ a-z0-9-_]+)*@[a-z0-9-]+(.[a-z0-9-_]+)*(.[a-z]{2,3})$', $str))
return true;
else
return false;;
}
// check to see if the email is valid
if (!is_email_valid($email))
{
$error="Please enter a valid email";
return($error);
}Thanks.