Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > ColdFusion

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-04-2008, 11:15 AM   PM User | #1
tom123
Regular Coder

 
Join Date: Apr 2005
Location: Ireland
Posts: 122
Thanks: 4
Thanked 0 Times in 0 Posts
tom123 is an unknown quantity at this point
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:

Code:
<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 is offline   Reply With Quote
Old 03-05-2008, 03:34 PM   PM User | #2
tom123
Regular Coder

 
Join Date: Apr 2005
Location: Ireland
Posts: 122
Thanks: 4
Thanked 0 Times in 0 Posts
tom123 is an unknown quantity at this point
Firured it out eventually for any1 interested.

Code:
<cfset formatedEventName   = REReplaceNoCase(qSearchDetailsSorted.EventName,"(#ls_txtString#)","<span class=searchHighlight>\1</span>","ALL") />
tom123 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:13 PM.


Advertisement
Log in to turn off these ads.