View Full Version : Reg Exp

03-04-2008, 12:15 PM

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

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

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