GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `re` should support `\p{...}` character properties · Issue #95555 · python/cpython

re should support \p{...} character properties #95555

New issue
Copy link
New issue
Copy link
Open
Open
re should support \p{...} character properties#95555
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-regextype-featureA feature request or enhancementA feature request or enhancement

Description

@LonYui
LonYui
opened on Aug 2, 2022
Issue body actions

Feature or enhancement

Reproduced steps

re.compile('\p{script=Han}') # 

actual:
will throw error
expect:
pass

Info:

  • p stand for properity , Han stand for mandarin
  • what is p? http://unicode.org/reports/tr18/#Categories

changed log
8/3 add more info . Final thx @JelleZijlstra give an helpful link

Linked PRs

  • gh-95555: Support Unicode property escapes \p{...} in regular expressions #151969
  • gh-95555: Allow a negated property as a character set member #152245
  • gh-95555: Add the CATEGORY_UCD opcode and the simple enumerated properties #153023
  • gh-95555: Fix a stale comment about negating \P in a character class #156490
Reacted by Kohányi Róbert

Activity

  1. LonYui
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Aug 2, 2022
  2. JelleZijlstra commented on Aug 2, 2022

    @JelleZijlstra
    JelleZijlstra
    on Aug 2, 2022
    Member
    More actions

    Could you clarify why you think this should work? As far as I can tell \p has no special meaning in regex.

    Reacted by 朧月
  3. AlexWaygood
    added
    topic-regex
    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
    on Aug 2, 2022
  4. ronaldoussoren commented on Aug 2, 2022

    @ronaldoussoren
    ronaldoussoren
    on Aug 2, 2022
    Contributor
    More actions

    They may mean character properties as described here: https://www.unicode.org/reports/tr18/#property_syntax

    Perl has similar functionality.

    Reacted by 朧月 and Oleg Iarygin
  5. mrabarnett commented on Aug 2, 2022

    @mrabarnett
    mrabarnett
    on Aug 2, 2022
    More actions

    Unicode properties are supported in the 'regex' package on PyPI here: https://pypi.org/project/regex/

    Reacted by 朧月, Lijd and Martin Zaťko
  6. corona10
    changed the title [-]re: 應該支援漢字正則表達式 \p{Han}[/-] [+]re: should support Chinese character regular expression \p{Han}[/+] on Aug 3, 2022
  7. corona10 commented on Aug 3, 2022

    @corona10
    corona10
    on Aug 3, 2022
    Member
    More actions

    @LonYui

    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 Noord
  8. arhadthedev commented on Mar 4, 2023

    @arhadthedev
    arhadthedev
    on Mar 4, 2023
    Member
    More actions

    Removing the pending label because @ronaldoussoren explained what the OP means.

  9. arhadthedev
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    and removed
    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
    on Mar 4, 2023
  10. arhadthedev
    changed the title [-]re: should support Chinese character regular expression \p{Han}[/-] [+]`re` should support `\p{...}` character properties[/+] on Mar 4, 2023
  11. arhadthedev commented on Mar 4, 2023

    @arhadthedev
    arhadthedev
    on Mar 4, 2023
    Member
    More actions

    Note: currently re supports only \number, \a, \b, \f, \n, \N, \r, \t, \u, \U, \v, \x, and \\.

  12. ncoghlan commented on Jun 24, 2025

    @ncoghlan
    ncoghlan
    on Jun 24, 2025
    Contributor
    More actions

    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)

  13. serhiy-storchaka
    added 4 commits that reference this issue on Jun 23, 2026

    pythongh-95555: Add Regional_Indicator, Hex_Digit and ASCII_Hex_Digit…

    388a3b6

    pythongh-95555: Change the re MAGIC number to 20260622

    55a2db7

    gh-95555: Support Unicode property escapes \p{...} in regular express…

    794b42f

    gh-95555: Allow a negated property as a character set member (GH-152245)

    8eb6fb0
  14. serhiy-storchaka
    added a commit that references this issue on Jul 5, 2026

    pythongh-95555: Register the RE capsule globals for the C-globals check

    3d4e93a
  15. hugovk
    marked New sequences for Unicode groups and block ranges needed #43715 as a duplicate of this issue on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-regextype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.