mirror of
https://github.com/python/cpython.git
synced 2025-07-12 05:45:15 +00:00
- experimental: added two new attributes to the match object:
"lastgroup" is the name of the last matched capturing group, "lastindex" is the index of the same group. if no group was matched, both attributes are set to None. the (?P#) feature will be removed in the next relase.
This commit is contained in:
parent
c9c02c4cf3
commit
c2301730b8
4 changed files with 38 additions and 13 deletions
|
@ -515,6 +515,8 @@ def _parse(source, state):
|
|||
group = state.getgroup(name)
|
||||
while 1:
|
||||
p = _parse(source, state)
|
||||
if group is not None:
|
||||
p.append((INDEX, group))
|
||||
if source.match(")"):
|
||||
if b:
|
||||
b.append(p)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue