shadowline
Exploding and Imploding << Regular Expressions >> Metacharacters
Regular expressions are matching patterns. First you tell the script what you want to search for and where, then it will try to find it. If the search is a success, a TRUE value will appear. If the search is a failure, a FALSE value will appear.

A pattern is what you are looking for in a specific area. It can be a word, a letter, whatever. For our examples, we will use the letter z.

There are two commands to use for searching. ereg for doing a case sensitive search (for specifically a lower or upper case letter) or eregi for doing a case insenitive search (searching for either a lower or upper case letter).

The ereg command takes two properties. One for the pattern to search for, the second for the search area.

ereg
<?php
$pattern = "z";
$search_area = "My car goes ZOOM.";
$search_result = ereg($pattern,$search_area);

if ($search_result){
// print this if there is a true result.
echo "Success, the pattern was found!";
} else {
// print this if there is a false result.
echo "Failure, the pattern was not found!";
}
?>
result :

Fatal error: Uncaught Error: Call to undefined function ereg() in /misc/40/000/085/738/8/user/web/htmlite.com/php032.php:45 Stack trace: #0 {main} thrown in /misc/40/000/085/738/8/user/web/htmlite.com/php032.php on line 45