org.apache.regexp.RE.setMatchFlags()方法的使用及代码示例

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

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

RE.setMatchFlags介绍

[英]Sets match behaviour flags which alter the way RE does matching.
[中]设置匹配行为标志,以改变重新进行匹配的方式。

代码示例

代码示例来源:origin: com.github.jkutner/saferegex

/**
 * Construct a matcher for a pre-compiled regular expression from program
 * (bytecode) data.  Permits special flags to be passed in to modify matching
 * behaviour.
 *
 * @param program Compiled regular expression program (see RECompiler and/or recompile)
 * @param matchFlags One or more of the RE match behaviour flags (RE.MATCH_*):
 *
 * <pre>
 *   MATCH_NORMAL              // Normal (case-sensitive) matching
 *   MATCH_CASEINDEPENDENT     // Case folded comparisons
 *   MATCH_MULTILINE           // Newline matches as BOL/EOL
 * </pre>
 *
 * @see RECompiler
 * @see REProgram
 * @see recompile
 */
public RE(REProgram program, int matchFlags)
{
  setProgram(program);
  setMatchFlags(matchFlags);
}

代码示例来源:origin: org.apache.ant/ant-apache-regexp

/**
 * Compile the pattern.
 *
 * @param options the ant regexp options
 * @return a compiled pattern
 * @exception BuildException if an error occurs
 */
protected RE getCompiledPattern(int options)
  throws BuildException {
  int cOptions = getCompilerOptions(options);
  try {
    RE reg = new RE(pattern);
    reg.setMatchFlags(cOptions);
    return reg;
  } catch (RESyntaxException e) {
    throw new BuildException(e);
  }
}

代码示例来源:origin: org.opennms/opennms-xmp

valueRegex = new RE(valueOperand);
if (!caseSensitive) {
  valueRegex.setMatchFlags(RE.MATCH_CASEINDEPENDENT);

代码示例来源:origin: anb0s/LogViewer

public JakartaRegExpRule(LogToolRuleDesc ruleDesc) {
  regexp = REUtil.createRE(ruleDesc.getRuleValue());
  int flags = regexp.getMatchFlags();
  if (ruleDesc.isCaseInsensitive())
    flags = org.apache.regexp.RE.MATCH_CASEINDEPENDENT;
  regexp.setMatchFlags(flags);
  priority = ruleDesc.getPriority();
  successToken = new Token(new TokenData(TextAttributeFactory.getTextAttribute(ruleDesc),priority));
}

相关文章