summaryrefslogtreecommitdiff
path: root/Lib/sre_parse.py
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2000-07-02 22:25:39 +0000
committerFredrik Lundh <fredrik@pythonware.com>2000-07-02 22:25:39 +0000
commitd64855bf2f5906567286a978648d47625a4db89c (patch)
treeab917b613074702dcd76d56a67a5264d858d52e4 /Lib/sre_parse.py
parent0c04f61d697f2cea67b08c1852e6f7945a2d0f36 (diff)
downloadcpython-d64855bf2f5906567286a978648d47625a4db89c.tar.gz
- 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.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r--Lib/sre_parse.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index 81ca217a47..d78737f2a5 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -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)