Ok, if I understand correctly, I would do something like this:
<cffunction name="reMatchGroups" access="public" returntype="array" output="false">
<cfargument name="text" type="string" required="true" />
<cfargument name="pattern" type="string" required="true" />
<cfargument name="scope" type="string" required="false" default="all" />
<cfscript>
l = {};
l.results = [];
l.pattern = createObject("java", "java.util.regex.Pattern").compile(javacast("string", arguments.pattern));
l.matcher = l.pattern.matcher(javacast("string", arguments.text));
while(l.matcher.find()) {
l.groups = {};
for(l.i = 1; l.i <= l.matcher.groupCount(); l.i++) {
l.groups[l.i] = l.matcher.group(javacast("int", l.i));
}
arrayAppend(l.results, l.groups);
if(arguments.scope == "one")
break;
}
return l.results;
</cfscript>
</cffunction>
The above function returns groups for each regex pattern match.
You could use it like this:
<cfset a = reMatchGroups("<a href=""http://iamalink.com"" class=""testlink"">This is a link</a>", "href=[""']([^""|']*)[""'][^>]*>([^<]*)", "all") />
Which will give you an array of structs with the key-value pairs for each back reference in the regex. In this case the href and node text.