note 20869 added to function.preg-replace
| From: | jbe at cpu dot ath dot cx | Date: | Fri, 19 Apr 2002 14:04:19 +0000 |
| Subject: | note 20869 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29573@lists.php.net to get a copy of this message | ||
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>.
*
*/
--
http://www.php.net/manual/en/function.preg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+20869
http://master.php.net/manage/user-notes.php?action=delete+20869
http://master.php.net/manage/user-notes.php?action=reject+20869