英文:
\p{InLatin1Supplement} is an unknown unicode-character-property-name in Regex
问题
"The docs for java.util.regex.Pattern
specify:
> Blocks are specified with the prefix In, as in InMongolian, or by
> using the keyword block (or its short form blk) as in block=Mongolian
> or blk=Mongolian.
>
> The block names supported by Pattern are the valid block names
> accepted and defined by UnicodeBlock.forName.
and there exists a constant Character.UnicodeBlock.LATIN_1_SUPPLEMENT
which does get found by UnicodeBlock.forName
.
Either way, I'm getting a
java.util.regex.PatternSyntaxException: Unknown character property name {InLatin1Supplement} near index 21
\p{InLatin1Supplement}
^
Whats up with that?"
英文:
The docs for java.util.regex.Pattern
specify:
> Blocks are specified with the prefix In, as in InMongolian, or by
> using the keyword block (or its short form blk) as in block=Mongolian
> or blk=Mongolian.
>
> The block names supported by Pattern are the valid block names
> accepted and defined by UnicodeBlock.forName.
and there exists a constant Character.UnicodeBlock.LATIN_1_SUPPLEMENT
which does get found by UnicodeBlock.forName
.
Either way, I'm getting a
java.util.regex.PatternSyntaxException: Unknown character property name {InLatin1Supplement} near index 21
\p{InLatin1Supplement}
^
Whats up with that?
答案1
得分: 1
在Java中,Unicode属性类看起来像
\p{InLatin_1_Supplement}
请参见在线Java演示:
String s = "ëè";
System.out.println(s.matches("\\p{InLatin_1_Supplement}+")); // -> true
英文:
The Unicode property class in Java looks like
\p{InLatin_1_Supplement}
See the Java demo online:
String s = "ëè";
System.out.println(s.matches("\\p{InLatin_1_Supplement}+")); // -> true
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论