\p{InLatin1Supplement} 在正则表达式中是一个未知的 Unicode 字符属性名称。

huangapple go评论73阅读模式
英文:

\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

huangapple
  • 本文由 发表于 2023年3月3日 21:51:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75627927.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定