Helpful Information
 
 
Category: ColdFusion
Reg Exp

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

Firured it out eventually for any1 interested.


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










privacy (GDPR)