Skip to content

\p{Alphabetic} matches gc=L, not the Unicode Alphabetic property #155498

Description

@fedonman

Bug description:

The Unicode Alphabetic property is derived as Uppercase + Lowercase + Lt + Lm + Lo + Nl + Other_Alphabetic, so \p{Uppercase} and \p{Lowercase} are subsets of \p{Alphabetic}. In re they are not:

$ ./python -c "import re; print(bool(re.fullmatch(r'\p{Uppercase}', 'Ⅰ')), bool(re.fullmatch(r'\p{Alphabetic}', 'Ⅰ')))"
True False

U+2160 ROMAN NUMERAL ONE is gc=Nl with Other_Uppercase=Yes. 163 characters match \p{Uppercase} or \p{Lowercase} but not \p{Alphabetic}, which matches General_Category=L exactly, the same set as \p{L}. The POSIX alias \p{alpha} behaves the same way. Doc/library/re.rst lists Alphabetic among the supported binary properties and names only space and xdigit as deviations from UTS #18 RL1.2.

Expected: \p{Alphabetic} matches the UCD property, or the deviation is documented alongside space and xdigit.

Not gh-56940 (\w under RL1.2a, predates \p{...}), and not covered by GH-153023, whose properties are the enumerated ones plus ccc, Bidi_Mirrored and Extended_Pictographic.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions