Ruby runtime = context.runtime;
byte[]bytes = value.getUnsafeBytes();
int begin = value.getBegin();
int len = value.getRealSize();
int range = begin + len;
final Matcher matcher = prepared.matcher(bytes, begin, range);
DynamicScope scope = context.getCurrentScope();
int end = 0;
RubyMatchData match = null;
if (pattern.numberOfCaptures() == 0) {
while (matcher.search(begin + end, range, Option.NONE) >= 0) {
end = positionEnd(matcher, enc, begin, range);
match = RubyRegexp.updateBackRef19(context, this, scope, matcher, pattern);
match.regexp = regexp;
RubyString substr = makeShared19(runtime, matcher.getBegin(), matcher.getEnd() - matcher.getBegin());
substr.infectBy(tuFlags);
match.infectBy(tuFlags);
block.yield(context, substr);
modifyCheck(bytes, len, enc);
}
} else {
while (matcher.search(begin + end, range, Option.NONE) >= 0) {
end = positionEnd(matcher, enc, begin, range);
match = RubyRegexp.updateBackRef19(context, this, scope, matcher, pattern);
match.regexp = regexp;
match.infectBy(tuFlags);
block.yield(context, populateCapturesForScan(runtime, matcher, range, tuFlags, true));