A lot depends on the search pattern. But as you loop keep track of where the previous occurrence was found. Then start searching *after* that position. Otherwise, refind will just return the first occurrence over and over again. You can use the fourth parameter of reFind to get the position and length of the string found ie reFind(pattern, string, startPosition, returnSubExpression). Then use those values to shift the starting search position forward each time you loop.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7e9a.html Not highly tested, but something along these lines <cfset startAt = 1 /> <cfloop index="i" from="1" to="#ArrayLen(getMatches)#"> <cfset found = REFind(url.terms, DocContents, startAt, true) /> <!--- insert *before* the matching string ---> <cfset DocContents = Insert( i, DocContents, found.pos[1]-1) /> <!--- shift starting position forward to ensure we find a *new* occurrence ---> <cfset startAt = found.pos[1] + found.len[1] + len(i) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:350097 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm