Code that worked in ColdFusion 10 prior to Java 7

This code that I use in a few places has stopped working, but only since the Java 7 updated version of ColdFusion. There error is no group name [5] which means that the matcher has changed between Java 6 and Java 7. Anyone with Java have a clue what needs to change here.

var regex = “(?si)(


var pattern = createObject(“java”, “java.util.regex.Pattern”);

var matcher = pattern.compile(regex).matcher(builder.toString());

var newContent = ‘’;

while(matcher.find()) {

var matchedString =;

var brush =;

if(isNull(brush)) { brush = “js”; }

savecontent variable=“newContent” {



var rLocation = builder.indexOf( matchedString );

var rLen = len( matchedString );

builder.replace( rLocation, rLocation+rLen, newContent);


Hi Andrew,

I think Java-7 only added some 6-8 new features but mostly improvement in collection framework and dynamic invoke.

This would be interesting to figure out what’s changed. If you provide “full text of builder.toString()” then I will do experiments in Java6, Java7 with some unit testing.

If you already figure out workaround/solution then please share with us.

The string is easy all it is, is something like this


..// some ColdFusion code


Now the strange thing is that the only difference between what ColdFusion 10 and the new ColdFusion 10, is the Java 7 introduction. Now I believe the update 8 had this in it as well, which makes me wonder if there is something else wrong, reason being is that the production site works and it has the update 8. But development we have a new complete ColdFusion 10 installation as this is on Windows 8, so I need to remove the old version and apply this.

But from what I can tell the group is failing with no group information. And that makes me stumped..

Andrew Scott
WebSite: http://[](
Google+: [](

I guess nobody knows the answer to this problem then?

What I can say for sure is that this has somehow changed in Java 7, and appears that this has something to do with the fact that Java 7 now supports named groups.

But I would have thought that the old way should still work…


Andrew Scott