>This is a case for Regular Expressions (RegEx): > >REReplaceNoCase(answer, '(#search_string#)', '<span >class="keyword">\1</span>', 'all')# >
Heh, just seen this after the other thread, so guess I'll repeat what I said there: Using parentheses is completely unnecessary. Use \0 in the replacement string instead. If search_string is (for example) "$10" or ":)" or "a+b^c" or whatever then simply using it as a regex_pattern will cause problems. To solve this means escaping the meta-characters, for example, search_string.replaceAll('[$^*()+\[\]{}.?\\|]','\\$0') Putting both those together results in: REReplaceNoCase ( answer , search_string.replaceAll('[$^*()+\[\]{}.?\\|]','\\$0') , '<span class="keyword">\0</span>' , 'all' ) (Though of course, as noted in the other thread, this doesn't deal with HTML.) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351787 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm