< 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,2880 **** case "block": p = CharPredicates.forUnicodeBlock(value); break; case "gc": case "general_category": ! p = CharPredicates.forProperty(value); break; default: break; } if (p == null) --- 2870,2880 ---- 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)
*** 2886,2906 **** // \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); if (p == null) ! p = CharPredicates.forProperty(name); if (p == null) p = CharPredicates.forUnicodeScript(name); } 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 {In/Is" + name + "}"); } if (isComplement) { --- 2886,2906 ---- // \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, has(CASE_INSENSITIVE)); if (p == null) ! p = CharPredicates.forProperty(name, has(CASE_INSENSITIVE)); if (p == null) p = CharPredicates.forUnicodeScript(name); } 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 {In/Is" + name + "}"); } if (isComplement) {
*** 5665,5686 **** } 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); } } static interface BmpCharPredicate extends CharPredicate { default CharPredicate and(CharPredicate p) { ! 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) --- 5665,5686 ---- } 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); } } static interface BmpCharPredicate extends CharPredicate { default CharPredicate and(CharPredicate p) { ! 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 >