ereg() function searches a string, returning true if the pattern is found, and false otherwise. : ereg « String « PHP






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

1.Capturing Text Inside HTML or XML Tags
2.Displaying elements of $regs array
3.Filling Patterns with ereg
4.ereg.php
5.break $url down into three distinct pieces