$re = '/^\w+(?:[_-][^\W_]+)*@(?![\d._-]+\.[^\W_]+$)[^\W_]+(?:[_-][^\W_]+)*\.[^\W_]{2,3}$/m';
$str = 'xxx@_domain.com
xxx@domain_.com
xxx@-domain.com
xxx@domain-.com
-xxx@domain.in
xxx@111.com
xxx@1and1.com
xxx@us.com
xxx@my-india.com
xxx@me2.com
xxx@tv.com
xxx@abc_efg.com
_muth@tamil.com
xx-u@my-india.commmmm
x-xx@1and1.com
xxx@_domain.com => invalid @ starts with _
xxx@domain_.com => invalid domain ends with _
xxx@-domain.com => invalid @ starts with - ( hypen)
xxx@domain-.com => invlaid domain ends with - (hypen)
-xxx@domain.in => invalid domain start with - (hypen)
xxx@111.com => invalid domain only contains numbers
xxx@1and1.com => valid domain contains both number and chars
xxx@us.com => valid
xxx@my-india.com => valid
xxx@me2.com => valid
xxx@tv.com =>
xxx@abc_efg.com => valid _ inside the chars
_muth@tamil.com => valid _ start with ';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php