preg_match() function returns true if pattern exists, and false otherwise.
Its syntax follows: int preg_match (string pattern, string string [, array pattern_array])
<?
$line = "virtual";
if (preg_match("/\bVi\b/i", $line, $match)) :
print "Match found!";
endif;
?>
Related examples in the same category