Reg Experesion is a cool subject, try the php manual for a complete description, I have given a genereal function you can use to validate e-mail, it works, it's the one i use.
///////////////////////////////////////////////////// fundtion starts here//////////////////////////
function isEmail($mEmail,$mRequired)
{
// This function will check the e-mail is valid or not
// $mEmal - the e-mail address that we must check
// $mRequired - a flag that determins wether the e-mail is required or not
// $mRequired = 1 : E-Mail is mandotery
// $mRequired = 0 : E-mail is not Mandotery
if($mRequired == 1)
{
if(empty($mEmail) || !ereg("[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]", $mEmail))
{
return false;
}
else
{
return true;
}
}
else if($mRequired == 0)
{
if(empty($mEmail))
return true;
else
{
if(!ereg("[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]", $mEmail))
{
return false;
}
else
{
return true;
}
}
}
}
////////////////////////////////////////// funtion ends here////////////////////////////////
hope this will help you, it'll return true if the e-mail is valid, false otherwise,
you must pass the string you want to validate and $mRequired,
$mRequired, carry 2 values, 0,1
pass 0 : if your web form says that e-mail is not a required field
pass 1: if your web form says that e-mail is a required field
Good Luck.