}
private static JS matchToExecResult(GnuRegexp.REMatch match, GnuRegexp.RE re, String s) {
+ if (match == null) return null;
try {
JS ret = new JS.Obj();
ret.put(JSU.S("index"), JSU.N(match.getStartIndex()));
args[args.length - 1] = JSU.S(s);
// note: can't perform pausing operations in here
- sb.append(JSU.toString(replaceFunc.call(args)));
+ sb.append(JSU.toString(replaceFunc.call(null, args)));
} else {
sb.append(mySubstitute(match,replaceString,s));