| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Implement set difference [A--B], intersection [A&&B] and union [A||B] in regular expression character classes (Unicode Technical Standard #18), including nested, complemented and compound set operands. Symmetric difference [A~~B] remains reserved. Also use the new syntax in the standard library (_strptime, textwrap, doctest, pkgutil). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documentation build overview3 files changed ± library/re.html ± whatsnew/3.16.html ± whatsnew/changelog.html |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Implement UTS #18 RL1.3 set operations in regular expression character classes: difference [A--B], intersection [A&&B] and union [A||B], with nested, complemented and compound operands and arbitrary left-to-right chaining ([a-z--[aeiou]&&\w]). Symmetric difference [A~~B] remains reserved (still a FutureWarning).
These tokens (--, &&, ||, and nested [) have been reserved since 3.7 via FutureWarning, so this turns the warnings into real syntax.
The feature is parser-only: each operation maps to an assertion on the matched character — [A--B] → A(?<![B]), [A&&B] → A(?<=[B]), [A||B] → a merged charset [AB] or an alternation — so no charset complement is ever formed and the result is correct under IGNORECASE. A leading ^ negates by De Morgan, pushing the negation into the operands. The engine and MAGIC are untouched.
A [ opens a nested set only immediately after a set operator; at the start of a class it stays an ordinary literal, so existing patterns such as [[:alpha:]] and glob's [*?[] keep their meaning.
The new syntax is also used in the standard library (_strptime, textwrap, doctest, pkgutil).
🤖 Generated with Claude Code