boolean (@NotNull String category) { if (category.startsWith("In")) { return isValidUnicodeBlock(category.substring(2)); } if (category.startsWith("Is")) { category = category.substring(2); if (isValidProperty(category)) return true; // Unicode properties and scripts available since JDK 1.7 category = StringUtil.toUpperCase(category); return switch (category) { // see java.util.regex.UnicodeProp // 4 aliases case "WHITESPACE", "HEXDIGIT", "NONCHARACTERCODEPOINT", "JOINCONTROL" -> true; case "ALPHABETIC", "LETTER", "IDEOGRAPHIC", "LOWERCASE", "UPPERCASE", "TITLECASE", "WHITE_SPACE", "CONTROL", "PUNCTUATION", "HEX_DIGIT", "ASSIGNED", "NONCHARACTER_CODE_POINT", "DIGIT", "ALNUM", "BLANK", "GRAPH", "PRINT", "WORD", "JOIN_CONTROL" -> true; default -> isValidUnicodeScript(category); }; } return isValidProperty(category); }