当前位置: 首页>>代码示例>>Java>>正文


Java Pattern.CASE_INSENSITIVE属性代码示例

本文整理汇总了Java中java.util.regex.Pattern.CASE_INSENSITIVE属性的典型用法代码示例。如果您正苦于以下问题:Java Pattern.CASE_INSENSITIVE属性的具体用法?Java Pattern.CASE_INSENSITIVE怎么用?Java Pattern.CASE_INSENSITIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.util.regex.Pattern的用法示例。


在下文中一共展示了Pattern.CASE_INSENSITIVE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findMatches

private List<InputNode> findMatches(String name, String value, InputGraph inputGraph, SearchResponse response) {
    try {
        RegexpPropertyMatcher matcher = new RegexpPropertyMatcher(name, value, Pattern.CASE_INSENSITIVE);
        Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<>(inputGraph.getNodes());
        List<InputNode> matches = selector.selectMultiple(matcher);
        return matches.size() == 0 ? null : matches;
    } catch (Exception e) {
        final String msg = e.getMessage();
        response.addResult(new Runnable() {
            @Override
            public void run() {
                Message desc = new NotifyDescriptor.Message("An exception occurred during the search, "
                        + "perhaps due to a malformed query string:\n" + msg,
                        NotifyDescriptor.WARNING_MESSAGE);
                DialogDisplayer.getDefault().notify(desc);
            }
        },
                "(Error during search)"
        );
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:NodeQuickSearch.java

示例2: setText

public void setText(String text, boolean regular, boolean wholeWords, boolean matchCase) {
    if (!regular) {
        text = Pattern.quote(text);
        if (wholeWords) {
            text ="\\b"+ text +"\\b"; // NOI18N
        }
    }
    int flags = 0;
    if (!matchCase) {
        flags |= Pattern.CASE_INSENSITIVE;
    }
    try {
        pattern = Pattern.compile(text, flags);
    } catch (PatternSyntaxException psex) {
        String message = NbBundle.getMessage(SummaryTextFilter.class, "FindInQueryBar.invalidExpression"); // NOI18N
        StatusDisplayer.getDefault().setStatusText(message, StatusDisplayer.IMPORTANCE_FIND_OR_REPLACE);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:SummaryTextFilter.java

示例3: updatePattern

void updatePattern() {
    reset();
    String p = bar.getPattern();
    if (!bar.getRegularExpression()) {
        p = Pattern.quote(p);
        if (bar.getWholeWords()) {
            p="\\b"+p+"\\b"; // NOI18N
        }
    }
    int flags = Pattern.MULTILINE;
    if (!bar.getMatchCase()) {
        flags |= Pattern.CASE_INSENSITIVE;
    }
    try {
        pattern = Pattern.compile(p, flags);
    } catch (PatternSyntaxException psex) {
        String message = NbBundle.getMessage(FindSupport.class, "FindBar.invalidExpression"); // NOI18N
        StatusDisplayer.getDefault().setStatusText(message, StatusDisplayer.IMPORTANCE_FIND_OR_REPLACE);
    }
    findNext();
    if (bar.getHighlightResults()) {
        highlight(tc, false);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:FindSupport.java

示例4: compile

@Override
public Pattern compile(String label)
{
    int reFlags = 0;
    if ((m_flags & SQLPatternFactory.CASE_SENSITIVE) == 0) {
        reFlags |= Pattern.CASE_INSENSITIVE;
    }
    if ((m_flags & SQLPatternFactory.IGNORE_NEW_LINE) == 0) {
        reFlags |= Pattern.DOTALL;
    }
    if ((m_flags & SQLPatternFactory.SINGLE_LINE) == 0) {
        reFlags |= Pattern.MULTILINE;
    }
    String regex = generateExpression(0);
    COMPILER_LOG.debug(String.format("PATTERN: %s: %s", label, regex));
    return Pattern.compile(regex, reFlags);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:SQLPatternPartElement.java

示例5: patternToJoniFlags

private int patternToJoniFlags(int flags) {
  int newFlags = 0;
  if ((flags & Pattern.CASE_INSENSITIVE) != 0) {
    newFlags |= Option.IGNORECASE;
  }
  if ((flags & Pattern.DOTALL) != 0) {
    // This does NOT mean Pattern.MULTILINE
    newFlags |= Option.MULTILINE;
  }
  if ((flags & Pattern.MULTILINE) != 0) {
    // This is what Java 8's Nashorn engine does when using joni and
    // translating Pattern's MULTILINE flag
    newFlags &= ~Option.SINGLELINE;
    newFlags |= Option.NEGATE_SINGLELINE;
  }
  return newFlags;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:RegexStringComparator.java

示例6: flagsToString

public static String flagsToString(int flags) {
    StringBuilder sb = new StringBuilder();
    if ((flags & Pattern.CASE_INSENSITIVE) != 0) {
        sb.append("CASE_INSENSITIVE|");
    }
    if ((flags & Pattern.MULTILINE) != 0) {
        sb.append("MULTILINE|");
    }
    if ((flags & Pattern.DOTALL) != 0) {
        sb.append("DOTALL|");
    }
    if ((flags & Pattern.UNICODE_CASE) != 0) {
        sb.append("UNICODE_CASE|");
    }
    if ((flags & Pattern.CANON_EQ) != 0) {
        sb.append("CANON_EQ|");
    }
    if ((flags & Pattern.UNIX_LINES) != 0) {
        sb.append("UNIX_LINES|");
    }
    if ((flags & Pattern.LITERAL) != 0) {
        sb.append("LITERAL|");
    }
    if ((flags & Pattern.COMMENTS) != 0) {
        sb.append("COMMENTS|");
    }
    if ((flags & UNICODE_CHARACTER_CLASS) != 0) {
        sb.append("UNICODE_CHAR_CLASS|");
    }
    return sb.toString();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:31,代码来源:Regex.java

示例7: AddRule

/**
 * @param regexp
 * @param output
 */
public void AddRule(String regexp, String output) {
	int nflags = 0 ;
	if (this.caseInsensitive)
	{
		nflags = Pattern.CASE_INSENSITIVE ;
	}
	RegExpRule rule = new RegExpRule() ;
	rule.pattern = Pattern.compile(regexp, nflags) ;
	rule.export = output ;
	lstRules.add(rule) ;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:15,代码来源:RegExpProcessor.java

示例8: flagForChar

private int flagForChar(char c) {
    switch (c) {
        case 'c': return Pattern.CANON_EQ;
        case 'i': return Pattern.CASE_INSENSITIVE;
        case 'l': return Pattern.LITERAL;
        case 'm': return Pattern.MULTILINE;
        case 's': return Pattern.DOTALL;
        case 'U': return Pattern.UNICODE_CHARACTER_CLASS;
        case 'u': return Pattern.UNICODE_CASE;
        case 'x': return Pattern.COMMENTS;
        default:
            throw new IllegalArgumentException("Unknown flag [" + c + "]");
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:ERegex.java

示例9: Finder

/**
 * Constructor for Finder.
 */
public Finder(
    HTMLEditor theEditor,
    String find,
    boolean wholeWord,
    boolean matchCase,
    boolean regexp,
    String replace) {
    super();
    editor = theEditor;
    dispText = find;
    int flags = Pattern.DOTALL;
    if (!matchCase)
        flags = flags + Pattern.CASE_INSENSITIVE + Pattern.UNICODE_CASE;
    _find = find;
    if (!regexp)
        _find = "\\Q" + _find + "\\E";
    if (wholeWord)
        _find = "[\\s\\p{Punct}]" + _find + "[\\s\\p{Punct}]";
    try {
        pattern = Pattern.compile(_find, flags);
    }
    catch (Exception ex) {
        ex.printStackTrace();
        pattern = null;
    }
    _replace = replace;
}
 
开发者ID:ser316asu,项目名称:SER316-Munich,代码行数:30,代码来源:Finder.java

示例10: flagsFromString

public static int flagsFromString(String flags) {
    int pFlags = 0;
    for (String s : Strings.delimitedListToStringArray(flags, "|")) {
        if (s.isEmpty()) {
            continue;
        }
        s = s.toUpperCase(Locale.ROOT);
        if ("CASE_INSENSITIVE".equals(s)) {
            pFlags |= Pattern.CASE_INSENSITIVE;
        } else if ("MULTILINE".equals(s)) {
            pFlags |= Pattern.MULTILINE;
        } else if ("DOTALL".equals(s)) {
            pFlags |= Pattern.DOTALL;
        } else if ("UNICODE_CASE".equals(s)) {
            pFlags |= Pattern.UNICODE_CASE;
        } else if ("CANON_EQ".equals(s)) {
            pFlags |= Pattern.CANON_EQ;
        } else if ("UNIX_LINES".equals(s)) {
            pFlags |= Pattern.UNIX_LINES;
        } else if ("LITERAL".equals(s)) {
            pFlags |= Pattern.LITERAL;
        } else if ("COMMENTS".equals(s)) {
            pFlags |= Pattern.COMMENTS;
        } else if (("UNICODE_CHAR_CLASS".equals(s)) || ("UNICODE_CHARACTER_CLASS".equals(s))) {
            pFlags |= UNICODE_CHARACTER_CLASS;
        } else {
            throw new IllegalArgumentException("Unknown regex flag [" + s + "]");
        }
    }
    return pFlags;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:Regex.java

示例11: RegexFileFilter

/**
 * Construct a new regular expression filter with the specified flags case sensitivity.
 *
 * @param pattern regular string expression to match
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the pattern is null
 */
public RegexFileFilter(String pattern, IOCase caseSensitivity) {
    if (pattern == null) {
        throw new IllegalArgumentException("Pattern is missing");
    }
    int flags = 0;
    if (caseSensitivity != null && !caseSensitivity.isCaseSensitive()) {
        flags = Pattern.CASE_INSENSITIVE;
    }
    this.pattern = Pattern.compile(pattern, flags);
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:17,代码来源:RegexFileFilter.java

示例12: parseFlags

public static int parseFlags(@Nullable BytesRef flagsString) {
    int flags = 0;
    if (flagsString == null) {
        return flags;
    }
    for (char flag : flagsString.utf8ToString().toCharArray()) {
        switch (flag) {
            case 'i':
                flags = flags | Pattern.CASE_INSENSITIVE;
                break;
            case 'u':
                flags = flags | Pattern.UNICODE_CASE;
                break;
            case 'U':
                flags = flags | Pattern.UNICODE_CHARACTER_CLASS;
                break;
            case 's':
                flags = flags | Pattern.DOTALL;
                break;
            case 'm':
                flags = flags | Pattern.MULTILINE;
                break;
            case 'x':
                flags = flags | Pattern.COMMENTS;
                break;
            case 'd':
                flags = flags | Pattern.UNIX_LINES;
                break;
            default:
                break;
        }
    }

    return flags;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:35,代码来源:RegexMatcher.java

示例13: parse

public void parse(Map<String, RewriteMap> maps) {
    // Parse the substitution
    if (!"-".equals(substitutionString)) {
        substitution = new Substitution();
        substitution.setSub(substitutionString);
        substitution.parse(maps);
    }
    // Parse the pattern
    int flags = 0;
    if (isNocase()) {
        flags |= Pattern.CASE_INSENSITIVE;
    }
    Pattern.compile(patternString, flags);
    // Parse conditions
    for (int i = 0; i < conditions.length; i++) {
        conditions[i].parse(maps);
    }
    // Parse flag which have substitution values
    if (isEnv()) {
        for (int i = 0; i < envValue.size(); i++) {
            Substitution newEnvSubstitution = new Substitution();
            newEnvSubstitution.setSub(envValue.get(i));
            newEnvSubstitution.parse(maps);
            envSubstitution.add(newEnvSubstitution);
            envResult.add(new ThreadLocal<String>());
        }
    }
    if (isCookie()) {
        cookieSubstitution = new Substitution();
        cookieSubstitution.setSub(cookieValue);
        cookieSubstitution.parse(maps);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:RewriteRule.java

示例14: PatternSearch

PatternSearch(final String patternText) {
	super(patternText, true, true, Pattern.CASE_INSENSITIVE
			| Pattern.DOTALL);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:4,代码来源:MessageRevFilter.java

示例15: PatternSearch

PatternSearch(final String patternText) {
	super(patternText, true, true, Pattern.CASE_INSENSITIVE);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:3,代码来源:CommitterRevFilter.java


注:本文中的java.util.regex.Pattern.CASE_INSENSITIVE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。