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 — Support set operations in regular expression character classes · Issue #152100 · python/cpython

Support set operations in regular expression character classes #152100

New issue
Copy link
New issue
Copy link
Open
Open
Support set operations in regular expression character classes#152100
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

@serhiy-storchaka
serhiy-storchaka
opened on Jun 24, 2026
Issue body actions

Feature or enhancement

Implement the set operations of Unicode Technical Standard #18 RL1.3 in re character classes, together with nested sets.

gh-74534 added FutureWarnings in Python 3.7 for the ambiguous constructs (--, &&, ~~, ||, and a leading [) as preparation for this syntax; this issue turns them into operators.

Two character sets are combined by an operator, where an operand may be a nested set in brackets:

  • [A--B] — difference: a character in A but not in B.
  • [A&&B] — intersection: a character in both A and B.
  • [A||B] — union: a character in A or B.
  • [A~~B] — symmetric difference: a character in A or B but not both.

Operators have no precedence and apply left to right; nested sets are used to group. A leading ^ complements the whole result.

For example, [a-z--[aeiou]] matches an ASCII lowercase consonant and [\w&&[a-z]] matches an ASCII lowercase letter.

Linked PRs

  • gh-152100: Support set operations in character classes #152153
  • gh-152100: Move re compiler optimizations to Lib/re/_optimizer.py #152154
  • gh-152100: Fuse set-operation character classes into a single charset #152214
  • gh-152100: Fuse set intersection into a single charset via INVERT #153022

Activity

  1. serhiy-storchaka
    added
    type-featureA feature request or enhancementA feature request or enhancement
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    topic-regex
    on Jun 24, 2026
  2. serhiy-storchaka
    added 4 commits that reference this issue on Jun 25, 2026

    pythongh-152100: Move re compiler optimizations to Lib/re/_optimizer.py

    586b2b8

    gh-152100: Support set operations in character classes (GH-152153)

    bd4bd3e

    gh-152100: Move re compiler optimizations to Lib/re/_optimizer.py (GH…

    a00464b

    gh-152100: Fuse set-operation character classes into a single charset (…

    d91e103
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.