I am trying to validate email in php using ereg, where I am not allowed to enter more than two dots after @ and it can't begin with any special character, how can I do it.
function chk($a)
{
$pattern = "^([A-Za-z0-9\.|-|_]{1,60})([@])";
$pattern .="([A-Za-z0-9\.|-|_]{1,60})(\.)([A-Za-z]{2,3})$";
if (!@ereg($pattern, $a))
return false;
else
return true;
}