On Mon, 4 Nov 2002 11:59:20 +0200, you wrote: >Ok, this works. > >Just one more thing, > >How can I get the return in the same case as it was originally?
Use backreferences to capture what matched and use that in the replace string. Example: <? $search = "is"; $str = "This is a test, isn't it?"; $str = preg_replace("/($search)/i", "<font color=\"red\">$1</font>", $str); echo $str; echo "<br>"; $str = "Is this also a test? Yes, it is!"; $str = preg_replace("/($search)/i", "<font color=\"red\">$1</font>", $str); echo $str; echo "<br>"; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php