<? $a = "Foo moo boo tool foo"; $b = preg_replace("/[A-Za-z]oo\b/e", 'strtoupper("$0")', $a); print $b; ?>