Repository navigation
re should support \p{...} character properties #95555
Description
Activity
- addedtype-featureA feature request or enhancementA feature request or enhancement
on Aug 2, 2022 Could you clarify why you think this should work? As far as I can tell
\phas no special meaning in regex.Reacted by 朧月- addedpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
on Aug 2, 2022 They may mean character properties as described here: https://www.unicode.org/reports/tr18/#property_syntax
Perl has similar functionality.
Reacted by 朧月 and Oleg IaryginUnicode properties are supported in the 'regex' package on PyPI here: https://pypi.org/project/regex/
Reacted by 朧月, Lijd and Martin Zaťko- changed the title
[-]re: 應該支援漢字正則表達式 \p{Han}[/-][+]re: should support Chinese character regular expression \p{Han}[/+]on Aug 3, 2022 re: 應該支援漢字正則表達式 \p{Han}
Please write the issue title in English if possible, some of the core devs are not familiar with Chinese.
(Same reason why I do not write issue titles in Korean.)
For reducing the cost of understanding your suggestion, I re-wrote the issue title in English.Reacted by 朧月 and Daniël van NoordRemoving the
pendinglabel because @ronaldoussoren explained what the OP means.- addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directoryand removedpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
on Mar 4, 2023 - changed the title
[-]re: should support Chinese character regular expression \p{Han}[/-][+]`re` should support `\p{...}` character properties[/+]on Mar 4, 2023 Note: currently re supports only
\number,\a,\b,\f,\n,\N,\r,\t,\u,\U,\v,\x, and\\.As a concrete example where this limitation can cause problems: while JSON Schema formally only supports a limited number of escape sequences, in practice schemas may end up containing patterns that use any of the defined JavaScript regex character classes.
Python supports most of the same character classes, but
\p/\Pis a notable omission. Whether or not that can reasonably be worked around by usingregexinstead ofredepends on how the affected regex is being processed (if it's in a third party library, it may not be straightforward to get it to use a different regex engine)- added 4 commits that reference this issue
on Jun 23, 2026
Feature or enhancement
Reproduced steps
actual:
will throw error
expect:
pass
Info:
changed log
8/3 add more info . Final thx @JelleZijlstra give an helpful link
Linked PRs