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

查看:449
本文介绍了什么是 {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 是什么?

What is L in this context?

推荐答案

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

检查 Unicode 字符属性 部分.

p{L} 匹配中的单个代码点信件"类别.如果您的输入字符串被编码为 U+0061 U+0300,它与没有重音的 a 匹配.如果输入被编码为 U+00E0,它匹配 à 与重音.原因是两个代码点 U+0061(a) 和 U+00E0 (à) 属于类别字母",而 U+0300 在类别标记".

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天全站免登陆