summaryrefslogtreecommitdiffstats
path: root/Lib/re
Commit message (Collapse)AuthorAgeFilesLines
* gh-109747: Improve errors for unsupported look-behind patterns (GH-109859)Serhiy Storchaka2023-10-142-4/+13
| | | | | | Now re.error is raised instead of OverflowError or RuntimeError for too large width of look-behind pattern. The limit is increased to 2**32-1 (was 2**31-1).
* gh-56166: Deprecate passing confusing positional arguments in re functions ↵Serhiy Storchaka2023-08-161-3/+64
| | | | | | | (#107778) Deprecate passing optional arguments maxsplit, count and flags in module-level functions re.split(), re.sub() and re.subn() as positional. They should only be passed by keyword.
* gh-100061: Proper fix of the bug in the matching of possessive quantifiers ↵SKO2023-08-161-7/+0
| | | | | | | | (GH-102612) Restore the global Input Stream pointer after trying to match a sub-pattern. Co-authored-by: Ma Lin <animalize@users.noreply.github.com>
* gh-106052: Fix bug in the matching of possessive quantifiers (gh-106515)Serhiy Storchaka2023-08-091-0/+7
| | | | | | It did not work in the case of a subpattern containing backtracking. Temporary implement possessive quantifiers as equivalent greedy qualifiers in atomic groups.
* gh-106566: Optimize (?!) in regular expressions (GH-106567)Serhiy Storchaka2023-08-071-1/+3
|
* gh-106510: Fix DEBUG output for atomic group (GH-106511)Serhiy Storchaka2023-07-081-1/+3
|
* gh-105687: Remove deprecated objects from `re` module (#105688)Nikita Sobolev2023-06-144-26/+3
|
* gh-91524: Speed up the regular expression substitution (#91525)Serhiy Storchaka2022-10-233-48/+21
| | | | | | | | | Functions re.sub() and re.subn() and corresponding re.Pattern methods are now 2-3 times faster for replacement strings containing group references. Closes #91524 Primarily authored by serhiy-storchaka Serhiy Storchaka Minor-cleanups-by: Gregory P. Smith [Google] <greg@krypto.org>
* gh-96346: Use double caching for re._compile() (#96347)Serhiy Storchaka2022-10-071-21/+46
|
* gh-91404: Revert "bpo-23689: re module, fix memory leak when a match is ↵Gregory P. Smith2022-06-172-39/+22
| | | | | | | | | | | | terminated by a signal or allocation failure (GH-32283) (#93882) Revert "bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure (GH-32283)" This reverts commit 6e3eee5c11b539e9aab39cff783acf57838c355a. Manual fixups to increase the MAGIC number and to handle conflicts with a couple of changes that landed after that. Thanks for reviews by Ma Lin and Serhiy Storchaka.
* gh-92728: Restore re.template, but deprecate it (GH-93161)Miro Hrončok2022-05-254-2/+27
| | | | | | Revert "bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)" This reverts commit b09184bf05b07b77c5ecfedd4daa846be3cbf0a9.
* gh-91760: More strict rules for numerical group references and group names ↵Serhiy Storchaka2022-05-081-28/+12
| | | | | | | | in RE (GH-91792) Only sequence of ASCII digits is now accepted as a numerical reference. The group name in bytes patterns and replacement strings can now only contain ASCII letters and digits and underscore.
* gh-91760: Deprecate group names and numbers which will be invalid in future ↵Serhiy Storchaka2022-04-301-7/+34
| | | | | | | | (GH-91794) Only sequence of ASCII digits will be accepted as a numerical reference. The group name in bytes patterns and replacement strings could only contain ASCII letters and digits and underscore.
* gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070)Serhiy Storchaka2022-04-301-0/+2
| | | Previously, pickling did not fail, but the result could not be unpickled.
* gh-91870: Remove unsupported SRE opcode CALL (GH-91872)Serhiy Storchaka2022-04-263-12/+1
| | | | | | | It was initially added to support atomic groups, but that support was never fully implemented, and CALL was only left in the compiler, but not interpreter and parser. ATOMIC_GROUP is now used to support atomic groups.
* RE: Pre-split the list of opcode names (GH-91859)Serhiy Storchaka2022-04-231-70/+71
| | | | 1. It makes them interned. 2. It allows to add comments to individual opcodes.
* gh-91308: Simplify parsing inline flag "x" (verbose) (GH-91855)Serhiy Storchaka2022-04-231-16/+4
|
* gh-91575: Add a script for generating data for case-insensitive matching in ↵Serhiy Storchaka2022-04-222-57/+108
| | | | | re (GH-91660) Also test that all extra cases are in BMP.
* gh-91700: Validate the group number in conditional expression in RE (GH-91702)Serhiy Storchaka2022-04-221-0/+10
| | | | | | In expression (?(group)...) an appropriate re.error is now raised if the group number refers to not defined group. Previously it raised RuntimeError: invalid SRE code.
* gh-90568: Fix exception type for \N with a named sequence in RE (GH-91665)Serhiy Storchaka2022-04-221-2/+2
| | | re.error is now raised instead of TypeError.
* gh-91575: Update case-insensitive matching in re to the latest Unicode ↵Serhiy Storchaka2022-04-181-3/+27
| | | | version (GH-91580)
* bpo-47152: Automatically regenerate sre_constants.h (GH-91439)Serhiy Storchaka2022-04-121-43/+0
| | | | | | | * Move the code for generating Modules/_sre/sre_constants.h from Lib/re/_constants.py into a separate script Tools/scripts/generate_sre_constants.py. * Add target `regen-sre` in the makefile. * Make target `regen-all` depending on `regen-sre`.
* bpo-47227: Suppress expression chaining for more RE parsing errors (GH-32333)Serhiy Storchaka2022-04-061-5/+5
|
* bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)Serhiy Storchaka2022-04-064-13/+2
| | | They were undocumented and never working.
* bpo-47152: Remove unused import in re (GH-32298)Serhiy Storchaka2022-04-041-4/+0
|
* bpo-47152: Move sources of the _sre module into a subdirectory (GH-32290)Serhiy Storchaka2022-04-041-1/+1
|
* bpo-23689: re module, fix memory leak when a match is terminated by a signal ↵Ma Lin2022-04-032-23/+40
| | | | or memory allocation failure (GH-32283)
* bpo-47152: Convert the re module into a package (GH-32177)Serhiy Storchaka2022-04-024-0/+2504
The sre_* modules are now deprecated.