public Matcher matcherNoRegion(byte[]bytes) { return matcherNoRegion(bytes, 0, bytes.length); }
public Matcher matcherNoRegion(byte[]bytes) { return matcherNoRegion(bytes, 0, bytes.length); }
private RubyBoolean matchP(ThreadContext context, IRubyObject arg, int pos) { if (arg == context.nil) return context.fals; RubyString str = arg instanceof RubySymbol ? ((RubySymbol) arg).to_s(context.runtime) : arg.convertToString(); if (pos != 0) { if (pos < 0) { pos += str.strLength(); if (pos < 0) return context.fals; } pos = str.rbStrOffset(pos); } final Regex reg = preparePattern(str); final ByteList strBL = str.getByteList(); final int beg = strBL.begin(); Matcher matcher = reg.matcherNoRegion(strBL.unsafeBytes(), beg, beg + strBL.realSize()); try { final int result = matcherSearch(context, matcher, beg + pos, beg + strBL.realSize(), RE_OPTION_NONE); return result == -1 ? context.fals : context.tru; } catch (JOniException je) { throw context.runtime.newRegexpError(je.getMessage()); } }
private RubyBoolean matchP(ThreadContext context, IRubyObject arg, int pos) { if (arg == context.nil) return context.fals; RubyString str = arg instanceof RubySymbol ? ((RubySymbol) arg).to_s(context.runtime) : arg.convertToString(); if (pos != 0) { if (pos < 0) { pos += str.strLength(); if (pos < 0) return context.fals; } pos = str.rbStrOffset(pos); } final Regex reg = preparePattern(str); final ByteList strBL = str.getByteList(); final int beg = strBL.begin(); Matcher matcher = reg.matcherNoRegion(strBL.unsafeBytes(), beg, beg + strBL.realSize()); try { final int result = matcherSearch(context, matcher, beg + pos, beg + strBL.realSize(), RE_OPTION_NONE); return result == -1 ? context.fals : context.tru; } catch (JOniException je) { throw context.runtime.newRegexpError(je.getMessage()); } }