我正在尝试验证依赖项是否可以与一些名为Immutable identifier:http://www.unicode.org/reports/tr31/#Immutable_Identifier_Syntax的特定unicode字符一起工作。
“不可变标识符”字符的定义是
Immutable Identifiers: To meet this requirement, an implementation shall define identifiers to be any non-empty string of characters that contains no character having any of the following property values:
Pattern_White_Space=True
Pattern_Syntax=True
General_Category=Private_Use, Surrogate, or Control
Noncharacter_Code_Point=True我能够弄清楚https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html中的Surrogate、PRIVATE_USE和Control字符是什么,但找不到其余的字符。这个Unicode文档对我来说也有点复杂,所以我没能理解它,找到了那些“不可变标识符”字符的码点范围:(。任何有一些背景的人都能有一些光芒吗?
发布于 2021-03-24 16:46:53
从Pattern的javadoc开始,特别是(Unicode) classs表。但它也包含Unicode参考链接。
"\\p{Space}" // Whitespace
"\\p{Punct}" // Interpunction
"\\p{M}" // Combined diacritical marks, zero-width accents还有更多。
此外,您可能希望规范化标识符。"é“可以写成一个Unicode代码点,也可以写成两个代码点:一个拉丁语e和一个零宽度重音。java.text.Normalizer可以做到这一点。压缩(一个代码点)似乎是最好的。
请看一下UAX。
"\\p{Pattern_Syntax}"不确定,但Pattern_Syntax字符可能包含[]?+*.,所以我认为Pattern_Syntax也可以。
https://stackoverflow.com/questions/66774597
复制相似问题