什么是{L} Unicode类别? [英] What is the {L} Unicode category?

查看:381
本文介绍了什么是{L} Unicode类别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一些包含 [^ \\p {L}] 的正则表达式。我知道这是使用某种形式的Unicode类别,但当我检查文档,我发现只有以下L类别:

I came across some regular expressions that contain [^\\p{L}]. I understand that this is using some form of a Unicode category, but when I checked the documentation, I found only the following "L" categories:

Lu  Uppercase letter    UPPERCASE_LETTER
Ll  Lowercase letter    LOWERCASE_LETTER
Lt  Titlecase letter    TITLECASE_LETTER
Lm  Modifier letter     MODIFIER_LETTER
Lo  Other letter        OTHER_LETTER

在此上下文中什么是 L

推荐答案

摘自此链接: http://www.regular-expressions.info/unicode.html

检查 Unicode字符属性部分。

\p {L}将
中的单个代码点与letter类别相匹配。如果你的输入
字符串被à编码为U + 0061 U + 0300,
它匹配没有重音的a。如果
输入为à编码为U + 00E0,则
将à与重音符号相匹配。
的原因是代码点U + 0061
(a)和U + 00E0(à)都在
字母类别中,而U + 0300在$ b中$ b类别mark。

\p{L} matches a single code point in the category "letter". If your input string is à encoded as U+0061 U+0300, it matches a without the accent. If the input is à encoded as U+00E0, it matches à with the accent. The reason is that both the code points U+0061 (a) and U+00E0 (à) are in the category "letter", while U+0300 is in the category "mark".

这篇关于什么是{L} Unicode类别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆