< prev index next >

src/java.base/share/classes/java/util/regex/Pattern.java

Print this page
rev 54580 : [mq]: 8214245-Case-insensitive-matching-doesnt-work-correctly-for-POSIX-character-classes

@@ -2870,11 +2870,11 @@
                 case "block":
                     p = CharPredicates.forUnicodeBlock(value);
                     break;
                 case "gc":
                 case "general_category":
-                    p = CharPredicates.forProperty(value);
+                    p = CharPredicates.forProperty(value, has(CASE_INSENSITIVE));
                     break;
                 default:
                     break;
             }
             if (p == null)

@@ -2886,21 +2886,21 @@
                 // \p{InBlockName}
                 p = CharPredicates.forUnicodeBlock(name.substring(2));
             } else if (name.startsWith("Is")) {
                 // \p{IsGeneralCategory} and \p{IsScriptName}
                 name = name.substring(2);
-                p = CharPredicates.forUnicodeProperty(name);
+                p = CharPredicates.forUnicodeProperty(name, has(CASE_INSENSITIVE));
                 if (p == null)
-                    p = CharPredicates.forProperty(name);
+                    p = CharPredicates.forProperty(name, has(CASE_INSENSITIVE));
                 if (p == null)
                     p = CharPredicates.forUnicodeScript(name);
             } else {
                 if (has(UNICODE_CHARACTER_CLASS)) {
-                    p = CharPredicates.forPOSIXName(name);
+                    p = CharPredicates.forPOSIXName(name, has(CASE_INSENSITIVE));
                 }
                 if (p == null)
-                    p = CharPredicates.forProperty(name);
+                    p = CharPredicates.forProperty(name, has(CASE_INSENSITIVE));
             }
             if (p == null)
                 throw error("Unknown character property name {In/Is" + name + "}");
         }
         if (isComplement) {

@@ -5665,22 +5665,22 @@
         }
         default CharPredicate union(CharPredicate p) {
             return ch -> is(ch) || p.is(ch);
         }
         default CharPredicate union(CharPredicate p1,
-                                    CharPredicate p2 ) {
+                                    CharPredicate p2) {
             return ch -> is(ch) || p1.is(ch) || p2.is(ch);
         }
         default CharPredicate negate() {
             return ch -> !is(ch);
         }
     }
 
     static interface BmpCharPredicate extends CharPredicate {
 
         default CharPredicate and(CharPredicate p) {
-            if(p instanceof BmpCharPredicate)
+            if (p instanceof BmpCharPredicate)
                 return (BmpCharPredicate)(ch -> is(ch) && p.is(ch));
             return ch -> is(ch) && p.is(ch);
         }
         default CharPredicate union(CharPredicate p) {
             if (p instanceof BmpCharPredicate)
< prev index next >