note 17167 deleted from function.ereg-replace by jimw
| From: | jimw@php.net | Date: | Mon, 17 Dec 2001 23:22:08 +0000 |
| Subject: | note 17167 deleted from function.ereg-replace by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23078@lists.php.net to get a copy of this message | ||
Just a quite note to show how to (case-insensitively) highlight a keyword in a block of text, whilst
preserving the case of the keyword as it is found in the text, rather than replacing it with the
case of the keyword that you are searching with. Good for site search engines.
//$key is your search word
$expandedkey=sql_regcase($key);
$blockoftext=ereg_replace($expandedkey,"<b><font
color=\"#FF0000\">\\0</font></b>", $blockoftext);