Example
function REReplaceCallback(re,str,callback) {
/*
Thanks to Ben Nadel
"Learning ColdFusion 8: REMatch() For Regular Expression Matching"
from 2007-06-13
https://www.bennadel.com/blog/769-learning-coldfusion-8-rematch-for-regular-expression-matching.htm
*/
pattern = CreateObject("java","java.util.regex.Pattern").Compile(Arguments.re);
matcher = pattern.Matcher(Arguments.str);
if(matcher.find()) {
groups = [];
for(var i = 1; i lte matcher.groupCount(); i++) {
ArrayAppend(groups,matcher.group(Val(i)));
}
return Arguments.callback(groups);
}
else {
return Arguments.callback(false);
}
}