Get a Quote Today!   |   + 1 (301) 424 3903




 
  Community
 
Need Help?
Visit our Training page
Request a Quote or Consultation
SIGN UP FOR THE TERATECH NEWSLETTER
 

ColdCuts

Cut: How to highlight searched words.
Cut#: 23 
Cut Date: 01/22/1999 
Cutter: Nathan Dintenfass 
Topic: Appearance 
Overview: You can use the ReplaceNoCase function, or a Regular Expression using REReplace.

The Replace would look something like below.

The only disadvantage of this is that it will highlight the word as a substring (which you might want to do if your search is returning it that way anyway).

The Regular Expression could search for the search term as a whole word (surrounded by spaces) in similar fashion.

Another option would be to use CF_Highlight or CFX_Highlight. Both are free tags available from the tag gallery.

 

Cut Code:
<CFSET HighlightedTextBlockVar = ReplaceNoCase(TextToFormatVar,
SearchTermVar, "<b>#SearchTermVar#</b>", "ALL")>