another regex question

From: Date: Sun, 12 Aug 2001 06:20:09 +0000
Subject: another regex question
Groups: php.general 
Request: Send a blank email to php-general+get-62293@lists.php.net to get a copy of this message
I have a function that goes through and highlights specified text: function HiLightText( $HilightThis, $InThis ) { if( $HilightThis == "" ) { $cRet = $InThis; } else { $cTextReplace = "<SPAN CLASS=\"HiLightText\">\\1</SPAN>"; $cRet = eregi_replace( "(".$HilightThis.")" , $cTextReplace, $InThis ); } return $cRet; } and it works great, except it also ends up hilighting text that falls within HTML tags, thus throwing off the display of the highlighted search results. How can I modify this to highlight the requested text appropriately, but skipping the HTML tags?

« previous php.general (#62293) next »