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

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

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

Regex.matcher介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

@Override
public int compareTo(byte[] value, int offset, int length) {
 // Use subsequence match instead of full sequence match to adhere to the
 // principle of least surprise.
 Matcher m = pattern.matcher(value);
 return m.search(offset, length, pattern.getOptions()) < 0 ? 1 : 0;
}

代码示例来源:origin: apache/phoenix

private boolean matches(byte[] bytes, int offset, int len) {
  int range = offset + len;
  Matcher matcher = pattern.matcher(bytes, offset, range);
  int ret = matcher.match(offset, range, Option.DEFAULT);
  return len == ret;
}

代码示例来源:origin: org.apache.hbase/hbase-client

@Override
public int compareTo(byte[] value, int offset, int length) {
 // Use subsequence match instead of full sequence match to adhere to the
 // principle of least surprise.
 Matcher m = pattern.matcher(value);
 return m.search(offset, length, pattern.getOptions()) < 0 ? 1 : 0;
}

代码示例来源:origin: apache/phoenix

Matcher matcher = pattern.matcher(srcBytes, 0, srcRange);
int cur = srcOffset;
List<PairInt> searchResults = new LinkedList<PairInt>();

代码示例来源:origin: apache/phoenix

private boolean substr(byte[] srcBytes, int offset, int range, ImmutableBytesWritable outPtr) {
  Matcher matcher = pattern.matcher(srcBytes, 0, range);
  boolean ret = matcher.search(offset, range, Option.DEFAULT) >= 0;
  if (ret) {
    int len = matcher.getEnd() - matcher.getBegin();
    outPtr.set(srcBytes, matcher.getBegin(), len);
  } else {
    outPtr.set(ByteUtil.EMPTY_BYTE_ARRAY);
  }
  return ret;
}

代码示例来源:origin: apache/phoenix

new PArrayDataTypeEncoder(PVarchar.INSTANCE, sortOrder);
int srcRange = srcOffset + srcLen;
Matcher matcher = pattern.matcher(srcBytes, 0, srcRange);
int cur = srcOffset;
boolean append;

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

private boolean matches(byte[] bytes, int offset, int len) {
  int range = offset + len;
  Matcher matcher = pattern.matcher(bytes, offset, range);
  int ret = matcher.match(offset, range, Option.DEFAULT);
  return len == ret;
}

代码示例来源:origin: apache/johnzon

@Override
public boolean test(final CharSequence string) {
  return regex.matcher(string.toString().getBytes(StandardCharsets.UTF_8))
     .search(0, string.length(), Option.NONE) > Matcher.FAILED;
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

private boolean matches(byte[] bytes, int offset, int len) {
  int range = offset + len;
  Matcher matcher = pattern.matcher(bytes, offset, range);
  int ret = matcher.match(offset, range, Option.DEFAULT);
  return len == ret;
}

代码示例来源:origin: org.dynjs/dynjs

public Region match(String str, int from) {
  byte[] strBytes = str.getBytes();
  Matcher matcher = this.pattern.matcher(strBytes, 0, strBytes.length);
  if (matcher.search(from, strBytes.length, 0) >= 0) {
    return matcher.getEagerRegion();
  }
  return null;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-client

@Override
public int compareTo(byte[] value, int offset, int length) {
 // Use subsequence match instead of full sequence match to adhere to the
 // principle of least surprise.
 Matcher m = pattern.matcher(value);
 return m.search(offset, length, pattern.getOptions()) < 0 ? 1 : 0;
}

代码示例来源:origin: harbby/presto-connectors

@Override
public int compareTo(byte[] value, int offset, int length) {
 // Use subsequence match instead of full sequence match to adhere to the
 // principle of least surprise.
 Matcher m = pattern.matcher(value);
 return m.search(offset, length, pattern.getOptions()) < 0 ? 1 : 0;
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

private boolean substr(byte[] srcBytes, int offset, int range, ImmutableBytesWritable outPtr) {
  Matcher matcher = pattern.matcher(srcBytes, 0, range);
  boolean ret = matcher.search(offset, range, Option.DEFAULT) >= 0;
  if (ret) {
    int len = matcher.getEnd() - matcher.getBegin();
    outPtr.set(srcBytes, matcher.getBegin(), len);
  } else {
    outPtr.set(ByteUtil.EMPTY_BYTE_ARRAY);
  }
  return ret;
}

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

private boolean substr(byte[] srcBytes, int offset, int range, ImmutableBytesWritable outPtr) {
  Matcher matcher = pattern.matcher(srcBytes, 0, range);
  boolean ret = matcher.search(offset, range, Option.DEFAULT) >= 0;
  if (ret) {
    int len = matcher.getEnd() - matcher.getBegin();
    outPtr.set(srcBytes, matcher.getBegin(), len);
  } else {
    outPtr.set(ByteUtil.EMPTY_BYTE_ARRAY);
  }
  return ret;
}

代码示例来源:origin: anba/es6draft

@Override
public MatcherStateImpl matcher(CharSequence s) {
  UEncoding enc = getEncoding();
  if (s != lastInput) {
    lastInput = s;
    lastInputBytes = enc.toBytes(s);
  }
  int length = lastInputBytes.length - enc.minLength();
  Matcher matcher = getPattern().matcher(lastInputBytes, 0, length);
  return new MatcherStateImpl(new EncodedString(enc, s), matcher, negativeLAGroups, namedGroups);
}

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

private RubyMatchData subBangMatch(ThreadContext context, RubyRegexp regexp, RubyString repl) {
  Regex pattern = regexp.getPattern();
  Regex prepared = regexp.preparePattern(this);
  int begin = value.getBegin();
  int range = begin + value.getRealSize();
  final Matcher matcher = prepared.matcher(value.getUnsafeBytes(), begin, range);
  if (RubyRegexp.matcherSearch(context, matcher, begin, range, Option.NONE) >= 0) {
    RubyMatchData match = RubyRegexp.createMatchData(context, this, matcher, pattern);
    match.regexp = regexp;
    return match;
  }
  return null;
}

代码示例来源:origin: anba/es6draft

@Override
public MatcherStateImpl matcher(String s) {
  UEncoding enc = getEncoding();
  if (s != lastInput) {
    lastInput = s;
    lastInputBytes = enc.toBytes(s);
  }
  int length = lastInputBytes.length - enc.minLength();
  Matcher matcher = getPattern().matcher(lastInputBytes, 0, length);
  return new MatcherStateImpl(new EncodedString(enc, s), matcher, negativeLAGroups, namedGroups);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

protected void handleFileEncodingComment(ByteList encodingLine) throws IOException {
  int realSize = encodingLine.getRealSize();
  int begin = encodingLine.getBegin();
  Matcher matcher = encodingRegexp.matcher(encodingLine.getUnsafeBytes(), begin, begin + realSize);
  int result = RubyRegexp.matcherSearch(parserSupport.getConfiguration().getRuntime(), matcher, begin, begin + realSize, Option.IGNORECASE);
  if (result < 0) return;
  int begs[] = matcher.getRegion().beg;
  int ends[] = matcher.getRegion().end;
  setEncoding(new ByteList(encodingLine.getUnsafeBytes(), begs[1], ends[1] - begs[1]));
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

protected void handleFileEncodingComment(ByteList encodingLine) throws IOException {
  int realSize = encodingLine.getRealSize();
  int begin = encodingLine.getBegin();
  Matcher matcher = encodingRegexp.matcher(encodingLine.getUnsafeBytes(), begin, begin + realSize);
  int result = RubyRegexp.matcherSearch(parserSupport.getConfiguration().getRuntime(), matcher, begin, begin + realSize, Option.IGNORECASE);
  if (result < 0) return;
  int begs[] = matcher.getRegion().beg;
  int ends[] = matcher.getRegion().end;
  setEncoding(new ByteList(encodingLine.getUnsafeBytes(), begs[1], ends[1] - begs[1]));
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private IRubyObject subBangNoIter(ThreadContext context, Regex pattern, RubyString repl) {
  int tuFlags = repl.flags;
  int range = value.getBegin() + value.getRealSize();
  Matcher matcher = pattern.matcher(value.getUnsafeBytes(), value.getBegin(), range);
  if (RubyRegexp.matcherSearch(context.runtime, matcher, value.getBegin(), range, Option.NONE) >= 0) {
    repl = RubyRegexp.regsub(repl, this, matcher, context.runtime.getKCode().getEncoding());
    RubyMatchData match = RubyRegexp.createMatchData(context, this, matcher, pattern);
    context.setBackRef(match);
    return subBangCommon(context, pattern, matcher, repl, tuFlags);
  } else {
    return context.setBackRef(context.runtime.getNil());
  }
}

相关文章