...

View Full Version : Reg Exp



tom123
03-04-2008, 11:15 AM
Hi

I have a string which may contain multiple occuernces of a search term in it.
I need to highlight each occurence of the search term by spacing a <span> around it.
I currently have:


<cfset formatedEventName = REReplaceNoCase(qSearchDetailsSorted.EventName,(ls_txtString),"<span class=searchHighlight></span>","ALL") />

Where qSearchDetailsSorted.EventName is the string and ls_txtString is the search term.
I dont know what to put inside the opening & closing span to output the actual search term in the string?

Thanks in advance

tom123
03-05-2008, 03:34 PM
Firured it out eventually for any1 interested.


<cfset formatedEventName = REReplaceNoCase(qSearchDetailsSorted.EventName,"(#ls_txtString#)","<span class=searchHighlight>\1</span>","ALL") />



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum