< prev index next >
src/java.base/share/classes/java/util/regex/Pattern.java
Print this page
rev 57965 : [mq]: 8214245-Case-insensitive-matching-doesnt-work-correctly-for-POSIX-character-classes
*** 2885,2895 ****
case "block":
p = CharPredicates.forUnicodeBlock(value);
break;
case "gc":
case "general_category":
! p = CharPredicates.forProperty(value);
break;
default:
break;
}
if (p == null)
--- 2885,2895 ----
case "block":
p = CharPredicates.forUnicodeBlock(value);
break;
case "gc":
case "general_category":
! p = CharPredicates.forProperty(value, has(CASE_INSENSITIVE));
break;
default:
break;
}
if (p == null)
*** 2901,2921 ****
// \p{InBlockName}
p = CharPredicates.forUnicodeBlock(name.substring(2));
} else if (name.startsWith("Is")) {
// \p{IsGeneralCategory} and \p{IsScriptName}
String shortName = name.substring(2);
! p = CharPredicates.forUnicodeProperty(shortName);
if (p == null)
! p = CharPredicates.forProperty(shortName);
if (p == null)
p = CharPredicates.forUnicodeScript(shortName);
} else {
! if (has(UNICODE_CHARACTER_CLASS)) {
! p = CharPredicates.forPOSIXName(name);
! }
if (p == null)
! p = CharPredicates.forProperty(name);
}
if (p == null)
throw error("Unknown character property name {" + name + "}");
}
if (isComplement) {
--- 2901,2920 ----
// \p{InBlockName}
p = CharPredicates.forUnicodeBlock(name.substring(2));
} else if (name.startsWith("Is")) {
// \p{IsGeneralCategory} and \p{IsScriptName}
String shortName = name.substring(2);
! p = CharPredicates.forUnicodeProperty(shortName, has(CASE_INSENSITIVE));
if (p == null)
! p = CharPredicates.forProperty(shortName, has(CASE_INSENSITIVE));
if (p == null)
p = CharPredicates.forUnicodeScript(shortName);
} else {
! if (has(UNICODE_CHARACTER_CLASS))
! p = CharPredicates.forPOSIXName(name, has(CASE_INSENSITIVE));
if (p == null)
! p = CharPredicates.forProperty(name, has(CASE_INSENSITIVE));
}
if (p == null)
throw error("Unknown character property name {" + name + "}");
}
if (isComplement) {
*** 5617,5627 ****
}
default CharPredicate union(CharPredicate p) {
return ch -> is(ch) || p.is(ch);
}
default CharPredicate union(CharPredicate p1,
! CharPredicate p2 ) {
return ch -> is(ch) || p1.is(ch) || p2.is(ch);
}
default CharPredicate negate() {
return ch -> !is(ch);
}
--- 5616,5626 ----
}
default CharPredicate union(CharPredicate p) {
return ch -> is(ch) || p.is(ch);
}
default CharPredicate union(CharPredicate p1,
! CharPredicate p2) {
return ch -> is(ch) || p1.is(ch) || p2.is(ch);
}
default CharPredicate negate() {
return ch -> !is(ch);
}
< prev index next >