mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +00:00
Refs #30116 -- Simplified regex match group access with Match.__getitem__().
The method has been available since Python 3.6. The shorter syntax is also marginally faster.
This commit is contained in:
committed by
Mariusz Felisiak
parent
23f6fbdd93
commit
d6aff369ad
@@ -148,7 +148,7 @@ def replace_named_groups(pattern):
|
||||
4. ^(?P<a>\w+)/b/(?P<c>\w+) ==> ^<a>/b/<c>
|
||||
"""
|
||||
named_group_indices = [
|
||||
(m.start(0), m.end(0), m.group(1))
|
||||
(m.start(0), m.end(0), m[1])
|
||||
for m in named_group_matcher.finditer(pattern)
|
||||
]
|
||||
# Tuples of (named capture group pattern, group name).
|
||||
|
||||
Reference in New Issue
Block a user