java.util.regex.Matcher.useAnchoringBounds()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(113)

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

Matcher.useAnchoringBounds介绍

[英]Determines whether this matcher has anchoring bounds enabled or not. When anchoring bounds are enabled, the start and end of the input match the '^' and '$' meta-characters, otherwise not. Anchoring bounds are enabled by default.
[中]确定此匹配器是否启用了锚定边界。启用锚定边界时,输入的开始和结束与“^”和“$”元字符匹配,否则不匹配。默认情况下,将启用锚定边界。

代码示例

代码示例来源:origin: robovm/robovm

private void resetMatcher() {
  if (matcher == null) {
    matcher = delimiter.matcher(buffer);
  } else {
    matcher.reset(buffer);
  }
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  matcher.region(findStartIndex, bufferLength);
}

代码示例来源:origin: stackoverflow.com

final int end = source.length();
Matcher m = Pattern.compile("dummy").matcher(source);
m.useTransparentBounds(true).useAnchoringBounds(false);
while (pos < end)

代码示例来源:origin: org.kitesdk/kite-morphlines-core

/**
 * Sets the anchoring of region bounds for this matcher.
 *
 * @param b a boolean indicating whether or not to use anchoring bounds.
 * @return this Matcher
 */
public Matcher useAnchoringBounds(boolean b) {
  matcher.useAnchoringBounds(b);
  return this;
}

代码示例来源:origin: kite-sdk/kite

/**
 * Sets the anchoring of region bounds for this matcher.
 *
 * @param b a boolean indicating whether or not to use anchoring bounds.
 * @return this Matcher
 */
public Matcher useAnchoringBounds(boolean b) {
  matcher.useAnchoringBounds(b);
  return this;
}

代码示例来源:origin: MobiVM/robovm

private void resetMatcher() {
  if (matcher == null) {
    matcher = delimiter.matcher(buffer);
  } else {
    matcher.reset(buffer);
  }
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  matcher.region(findStartIndex, bufferLength);
}

代码示例来源:origin: com.github.samtools/htsjdk

/**
 * Throw an exception if the sequence name is not valid.
 */
public static void validateSequenceName(final String name) {
  if (!LEGAL_RNAME_PATTERN.matcher(name).useAnchoringBounds(true).matches()) {
    throw new SAMException(String.format("Sequence name '%s' doesn't match regex: '%s' ", name, LEGAL_RNAME_PATTERN));
  }
}

代码示例来源:origin: ibinti/bugvm

private void resetMatcher() {
  if (matcher == null) {
    matcher = delimiter.matcher(buffer);
  } else {
    matcher.reset(buffer);
  }
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  matcher.region(findStartIndex, bufferLength);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

private void resetMatcher() {
  if (matcher == null) {
    matcher = delimiter.matcher(buffer);
  } else {
    matcher.reset(buffer);
  }
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  matcher.region(findStartIndex, bufferLength);
}

代码示例来源:origin: com.bugvm/bugvm-rt

private void resetMatcher() {
  if (matcher == null) {
    matcher = delimiter.matcher(buffer);
  } else {
    matcher.reset(buffer);
  }
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  matcher.region(findStartIndex, bufferLength);
}

代码示例来源:origin: com.jtransc/jtransc-rt

private void resetMatcher() {
  if (matcher == null) {
    matcher = delimiter.matcher(buffer);
  } else {
    matcher.reset(buffer);
  }
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  matcher.region(findStartIndex, bufferLength);
}

代码示例来源:origin: com.gluonhq/robovm-rt

private void resetMatcher() {
  if (matcher == null) {
    matcher = delimiter.matcher(buffer);
  } else {
    matcher.reset(buffer);
  }
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  matcher.region(findStartIndex, bufferLength);
}

代码示例来源:origin: samtools/htsjdk

/**
 * Throw an exception if the sequence name is not valid.
 */
public static void validateSequenceName(final String name) {
  if (!LEGAL_RNAME_PATTERN.matcher(name).useAnchoringBounds(true).matches()) {
    throw new SAMException(String.format("Sequence name '%s' doesn't match regex: '%s' ", name, LEGAL_RNAME_PATTERN));
  }
}

代码示例来源:origin: FlexoVM/flexovm

private void resetMatcher() {
  if (matcher == null) {
    matcher = delimiter.matcher(buffer);
  } else {
    matcher.reset(buffer);
  }
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  matcher.region(findStartIndex, bufferLength);
}

代码示例来源:origin: ripreal/V8LogScanner

public RgxReader(CharBuffer source) {
  pattern = Pattern.compile(EVENT_RGX, Pattern.DOTALL);
  buf = source;
  matcher = pattern.matcher(buf);
  buf.position(position);
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  result = new ArrayList<>(limit);
}

代码示例来源:origin: com.github.rwitzel.streamflyer/streamflyer-core

/**
 * @return Returns the matcher that can be used with a {@link RegexModifier} to match an alternative of tokens
 */
protected OnStreamMatcher createMatcher(String regexTokenAlternatives) {
  // use the default implementation
  Matcher matcher = Pattern.compile(regexTokenAlternatives, 0).matcher("");
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  return new OnStreamStandardMatcher(matcher);
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

/**
 * @return Returns the matcher that can be used with a {@link RegexModifier} to match an alternative of tokens
 */
protected OnStreamMatcher createMatcher(String regexTokenAlternatives) {
  // use the default implementation
  Matcher matcher = Pattern.compile(regexTokenAlternatives, 0).matcher("");
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  return new OnStreamStandardMatcher(matcher);
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

/**
 * See {@link #RegexModifier(String, int, String, int, int)}.
 */
public RegexModifier(String regex, int flags, MatchProcessor matchProcessor, int minimumLengthOfLookBehind,
    int newNumberOfChars) {
  Matcher jdkMatcher = Pattern.compile(regex, flags).matcher("");
  jdkMatcher.useTransparentBounds(true);
  jdkMatcher.useAnchoringBounds(false);
  init(new OnStreamStandardMatcher(jdkMatcher), matchProcessor, minimumLengthOfLookBehind, newNumberOfChars);
}

代码示例来源:origin: com.github.rwitzel.streamflyer/streamflyer-core

/**
 * See {@link #RegexModifier(String, int, String, int, int)}.
 */
public RegexModifier(String regex, int flags, MatchProcessor matchProcessor, int minimumLengthOfLookBehind,
    int newNumberOfChars) {
  Matcher jdkMatcher = Pattern.compile(regex, flags).matcher("");
  jdkMatcher.useTransparentBounds(true);
  jdkMatcher.useAnchoringBounds(false);
  init(new OnStreamStandardMatcher(jdkMatcher), matchProcessor, minimumLengthOfLookBehind, newNumberOfChars);
}

代码示例来源:origin: com.googlecode.streamflyer/streamflyer-core

protected OnStreamMatcher createMatcher(String regex, int flags) {
  Matcher matcher = Pattern.compile(regex, flags).matcher("");
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  return new OnStreamStandardMatcher(matcher);
}

代码示例来源:origin: com.github.rwitzel.streamflyer/streamflyer-core

protected OnStreamMatcher createMatcher(String regex, int flags) {
  Matcher matcher = Pattern.compile(regex, flags).matcher("");
  matcher.useTransparentBounds(true);
  matcher.useAnchoringBounds(false);
  return new OnStreamStandardMatcher(matcher);
}

相关文章