Hi Folks,
I'm trying to modify Raymond Camden's highlight udf to allow for multiple
terms, and I'm not having a lot of luck. But, I've never written a udf,
so....
Here's where I'm at so far, basically, my thinking is that I have to loop
over the regular expression for each term passed in, yes? But, it's not
working - doesn't throw an error, but doesn't highlight anything either.
(Yes, I realize that only the Not matchase part would loop right now...one
piece at a time.)
function highLight(str,word) {
var front = "<span style=""background-color: yellow;"">";
var i = 0;
var back = "</span>";
var matchCase = false;
if(ArrayLen(arguments) GTE 3) front = arguments[3];
if(ArrayLen(arguments) GTE 4) back = arguments[4];
if(ArrayLen(arguments) GTE 5) matchCase = arguments[5];
if(NOT matchCase)
for(i=1; i lt listlen(word, " "); i = i + 1)
return REReplaceNoCase(str,"#listgetat(word,i)#","#front#\1#back#","ALL");
else return REReplace(str,"(#word#)","#front#\1#back#","ALL");
}
Deanna Schneider
Interactive Media Developer
[EMAIL PROTECTED]
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists