Looks like my last reply was truncated. (Out of curiosity, I am resending a
cfscript version to see if the lack of tags makes a difference.)
<cfscript>
startAt = 1;
for (i = 1; i <= ArrayLen(getMatches); i++) {
found = REFind(url.terms, DocContents, startAt, true);
// insert *before* the matching string
DocContents = Insert( i, DocContents, found.pos[1]-1);
// shift starting position forward to ensure we find a *new* occurrence
startAt = found.pos[1] + found.len
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:350098
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm