ereg() function searches a string, returning true if the pattern is found, and false otherwise.
Its syntax is: int ereg(string pattern, string string, [array regs])
The search is case sensitive in regard to alphabetical characters.
Use ereg() to search strings for .com domains:
<?
$email="a@a.com";
$is_com = ereg("(\.)(com$)", $email);
print $is_com;
?>
Related examples in the same category