From c2301730b8e07ece0b7c4ff6b6b06a4895d370c7 Mon Sep 17 00:00:00 2001 From: Fredrik Lundh Date: Sun, 2 Jul 2000 22:25:39 +0000 Subject: - 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. --- Lib/sre_parse.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/sre_parse.py') 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) -- cgit v1.2.1