RubyMatchData match = rubyRegex.updateBackRef(context, this, frame, matcher);
match.use();
if (regex.numberOfCaptures() == 0) {
repl = objAsString(context, block.yield(context, substr(matcher.getBegin(), matcher.getEnd() - matcher.getBegin())));
} else {
Region region = matcher.getRegion();
repl = objAsString(context, block.yield(context, substr(region.beg[0], region.end[0] - region.beg[0])));
}
modifyCheck(bytes, size);
frozenCheck();
frame.setBackRef(match);
} else {
repl = rubyRegex.regsub(repl, this, matcher);
rubyRegex.updateBackRef(context, this, frame, matcher);
}
final int beg;
final int plen;
if (regex.numberOfCaptures() == 0) {
beg = matcher.getBegin();
plen = matcher.getEnd() - beg;
} else {
Region region = matcher.getRegion();
beg = region.beg[0];
plen = region.end[0] - beg;
}
ByteList replValue = repl.value;