org.joni.Regex.matcherNoRegion()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中org.joni.Regex.matcherNoRegion方法的一些代码示例,展示了Regex.matcherNoRegion的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Regex.matcherNoRegion方法的具体详情如下:
包路径:org.joni.Regex
类名称:Regex
方法名:matcherNoRegion

Regex.matcherNoRegion介绍

暂无

代码示例

代码示例来源:origin: org.jruby.joni/joni

public Matcher matcherNoRegion(byte[]bytes) {
  return matcherNoRegion(bytes, 0, bytes.length);
}

代码示例来源:origin: jruby/joni

public Matcher matcherNoRegion(byte[]bytes) {
  return matcherNoRegion(bytes, 0, bytes.length);
}

代码示例来源:origin: org.jruby/jruby-complete

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());
  }
}

代码示例来源:origin: org.jruby/jruby-core

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());
  }
}

相关文章