note 20869 deleted from function.preg-replace by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 12:30:42 +0000 |
| Subject: | note 20869 deleted from function.preg-replace by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57473@lists.php.net to get a copy of this message | ||
Note Submitter: jbe@cpu.ath.cx
----
If you want to quote strings case insensitively, without altering the case of the actual match (like
google does) :
$text = "Reading the documentation is allways recommanded, and the PHP manual is worth a
read";
$search = "read";
$text = preg_replace("'$search'i","<b>\\0</b>",$text);
/*
* will output :
* <b>Read</b>ing the documentation is allways
* recommanded, and the PHP manual is
* worth a <b>read</b>.
*
*/