>> Try the following one:
>> $result = "This is a test, isn't it?";
>> $search = "is";
>> $result = preg_replace( '/(' . $search . ')/i', "<span
>> class=\"highlight\">\$1</span>", $result );
>> Grtz Erwin
David Russell wrote:
> Hi Erwin,
> Yep, this does exactly what str_replace does.
No, it doens't...this one is case insensitive. The pattern (which is
"/(is)/i" in this example), has the i modifier (the last "i"), which means
case insensitive. In fact, the above regexp even preserves case for you!
> How can I make the whole thing case insensitive:
It already is, please try it again (I've doublechecked it by now) ;-))
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php