This content has been marked as final. Show 4 replies
One method would be to perform client side highlighting (without the upper case bit).
With this method, you will have to tokenize the search terms and trap out invalid regex patterns, such as stripping out undesirables from the search criteria and then creating the regEx pattern by using each word separated by the OR pipe ("|")
<cfset searchTerm = "test|foo|bar">
var re = /(#searchTerm#)/gi;
document.body.innerHTML = document.body.innerHTML.replace(re, "<span class='highlite'>$1</span>");
this is a bunch of text. and will test the highlighting of the text. FOO should be as well as bar and foobar.
Thank you, I will investigate and report back.
I have succeeded in creating a *nearly* perfect UDF for this task. In my case #busName# is a value returned from the first query (for a list of businesses) and #memberTrim# is the (trimmed) user provided search term. This UDF reformats the memberTrim to start with a Capital Letter, and appear Red.
I feel like this UDF could be trimmed down - It does work as-is, but I think I may have redundant or useless code in it. If anyone discovers a cleaner approach, please advise.
The resultant output NBN (New Business Name) is interjected into the #busName# via the UDF wrap;