Tuan wrote:
> Can somebody provide me with an example of how to highlight multiple keywords in a 
>search result? For example say I wanted to search for "macromedia coldfusion, studio" 
>the search results will highlight every instance of "macromedia", "coldfusion", and 
>"studio" in the document.

2 step process. First clean up yuor search string, probably best done by 
replacing all non-alphabetic characters with spaces, then dumping all 
the 1 char searchstrings (presuming English). The run a replace with 
what is left (no loop necessary if you use a regex). Pseudocode:

//cleanup:
terms = REReplaceNoCase(terms, "[^a-z]+"," ","All");
terms = REReplaceNoCase(terms, "^[a-z] | [a-z] | [a-z]$"," ","All");

//highlight
terms = Replace(terms, " ","|","All");
text = REReplaceNoCase(text,"(#terms#)","<em>\1</em>","All");

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to