\b and \B, equate to "On a word boundary" and "Not on a word boundary," respectively.
<?
$string = "this is a test!";
if (preg_match("/oo\b/i", $string)) {
}
preg_match("/oo\B/i", $string);
preg_match("/no\b/", "he said 'no!'");
preg_match("/royalty\b/", "royalty-free photograph");
?>
Related examples in the same category