更新时间:2023-02-25 22:20:50
正则表达式中的字符类匹配字符而不是字节,并匹配 Unicode 属性数据库中指定的字符属性.例如,w
可用于匹配日语表意文字.
Character classes in regular expressions match characters instead of bytes and match against the character properties specified in the Unicode properties database.
w
can be used to match a Japanese ideograph, for instance.
所以看起来你的问题的答案是是".
So it looks like the answer to your question is "yes".
但是,您可能希望使用 p{}
构造来直接访问特定的 Unicode 字符属性.您可能可以使用 p{L}
(或者更短的 pL
)表示字母和 pN
表示数字,感觉有点多相信你会得到你想要的.
However, you might want to use the p{}
construct to directly access specific Unicode character properties. You can probably use p{L}
(or, shorter, pL
) for letters and pN
for numbers and feel a little more confident that you'll get exactly what you want.