note 49543 deleted from function.preg-replace by didou
| From: | didou@php.net | Date: | Sun, 23 Apr 2006 22:53:50 +0000 |
| Subject: | note 49543 deleted from function.preg-replace by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109238@lists.php.net to get a copy of this message | ||
Note Submitter: shogal at mail dot ru
----
Quik way to highlight whole word:
<?
preg_replace(
"/(^|[^\w]){1}(".preg_quote($search,"/").")($|[^\w]){1}/i",
"\\1<span class='highlight'>\\2</span>\\3", $string);
?>
In some locales may not work so better way is to change \w to class of literals.