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.
changed the title [-]re: should support Chinese character regular expression \p{Han}[/-][+]`re` should support `\p{...}` character properties[/+]on Mar 4, 2023
Python supports most of the same character classes, but \p/\P is a notable omission. Whether or not that can reasonably be worked around by using regex instead of re depends 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)
Activity
JelleZijlstra commented on Aug 2, 2022
Could you clarify why you think this should work? As far as I can tell \p has no special meaning in regex.
ronaldoussoren commented on Aug 2, 2022
They may mean character properties as described here: https://www.unicode.org/reports/tr18/#property_syntax
Perl has similar functionality.
mrabarnett commented on Aug 2, 2022
Unicode properties are supported in the 'regex' package on PyPI here: https://pypi.org/project/regex/
corona10 commented on Aug 3, 2022
@LonYui
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.
arhadthedev commented on Mar 4, 2023
Removing the pending label because @ronaldoussoren explained what the OP means.
arhadthedev commented on Mar 4, 2023
Note: currently re supports only \number, \a, \b, \f, \n, \N, \r, \t, \u, \U, \v, \x, and \\.
ncoghlan commented on Jun 24, 2025
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/\P is a notable omission. Whether or not that can reasonably be worked around by using regex instead of re depends 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)
pythongh-95555: Add Regional_Indicator, Hex_Digit and ASCII_Hex_Digit…
pythongh-95555: Change the re MAGIC number to 20260622
gh-95555: Support Unicode property escapes \p{...} in regular express…
gh-95555: Allow a negated property as a character set member (GH-152245)
pythongh-95555: Register the RE capsule globals for the C-globals check