summaryrefslogtreecommitdiffstats
path: root/Lib/sre_parse.py
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2000-07-02 22:25:39 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2000-07-02 22:25:39 (GMT)
commitc2301730b8e07ece0b7c4ff6b6b06a4895d370c7 (patch)
treefa5dd23128e9b5acc45dfed3958c341bdb90be73 /Lib/sre_parse.py
parentc9c02c4cf3d3e508986d1e7a6840f3ef92f077a6 (diff)
downloadcpython-c2301730b8e07ece0b7c4ff6b6b06a4895d370c7.zip
cpython-c2301730b8e07ece0b7c4ff6b6b06a4895d370c7.tar.gz
cpython-c2301730b8e07ece0b7c4ff6b6b06a4895d370c7.tar.bz2
- 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 81ca217..d78737f 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)