java中正则表达式匹配时如何忽略大小写?

解决方案 »

  1.   

    compile
    public static Pattern compile(String regex,
                                  int flags)Compiles the given regular expression into a pattern with the given flags. 
    Parameters:
    regex - The expression to be compiled
    flags - Match flags, a bit mask that may include CASE_INSENSITIVE, MULTILINE, DOTALL, UNICODE_CASE, and CANON_EQ 
    Throws: 
    IllegalArgumentException - If bit values other than those corresponding to the defined match flags are set in flags 
    PatternSyntaxException - If the expression's syntax is invalid
    CASE_INSENSITIVE 可以