Problem
You want to perform regular expression with PHP.
Solution
Again PHP implementation of regular expression is very similar to Perl.
In the simpliest form, pattern matching:
$ php -q<<EOT
<?php
$str="hello world";
if(ereg("world","$str")) {
echo("got a match");
}
?>
EOT
got a match
Example
Similarly eregi operates the same, just it is case insensitive.
$ php -q<<EOT
<?php
$str="hello world";
if(eregi("WORLD","$str")) {
echo("got a matchn");
}
?>
EOT
got a match
Reference
[tags]PHP ereg, PHP eregi, PHP Coding School[/tags]