PHP preg_match examples
Example 1: preg_match in php
<?php
$str = "Check For Testing.";
if (preg_match("/\bCheck\b/i", $str, $match))
echo "Matched!";
else
echo "not matched";
?>
Example 2: preg_match in php
<?php
$line = "Vi is the greatest word processor ever created!";
if (preg_match("/\bVi\b/i", $line, $match)) :
print "Match found!";
endif;
?>
Example 3: php preg_match
preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] ) : int
Example 4: preg_match in php
<?php
$my_text="I Love Regular Expressions";
$my_array = preg_split("/ /", $my_text);
print_r($my_array );
?>