My Issue:-
I need to filter the email in PHP. I need to accept corporate email id. No need to accept gmail,yahoo,aol,rediff,hotmail, etc email ids.
This is my sample regular expression PHP code
Code: Select all
if(isset($_POST['email']))
{
$str = $_POST['email'];
$res = !preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([gmail|yahoo|rediff|hotmail|aol]+\.)+[a-z]{2,6}$/",$str);
print_r($res);
echo "<br>";
if($res)
{
echo "Correct Email Address";
}
else
{
echo "Wrong Email Address";
}
}
Is there any problem in code?
Please any one give me the suggestion for this problem?
Thanks
Tamilmani Mohan