Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the {L} Unicode category?

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

What is L in this context?

like image 687
uTubeFan Avatar asked May 11 '11 19:05

uTubeFan


People also ask

What is Unicode category?

Unicode 6.0 has 7 character categories, and each category has subcategories: Letter (L): lowercase (Ll), modifier (Lm), titlecase (Lt), uppercase (Lu), other (Lo) Mark (M): spacing combining (Mc), enclosing (Me), non-spacing (Mn) Number (N): decimal digit (Nd), letter (Nl), other (No)

Is a period a Unicode character?

- Full Stop: U+002E period - Unicode Character Table.


1 Answers

Taken from this link: http://www.regular-expressions.info/unicode.html

Check the Unicode Character Properties section.

\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".

like image 192
Favonius Avatar answered Sep 19 '22 04:09

Favonius