Hi,
I wrote an easy patch for redemo.py to print named groups.
For example,
regexp: (?P<spam>.*)
string: foobar
shows following groups.
Groups:
0: 'foobar'
1: 'foobar'
'spam': 'foobar'
I don't know how/where to commit this patch..
any suggestions?
--- Tools/scripts/redemo.py 2004-02-13 02:35:32.000000000 +0900
+++ redemo.py 2006-08-21 01:11:11.000000000 +0900
@@ -148,6 +148,10 @@
for i in range(len(groups)):
g = "%2d: %r" % (i, groups[i])
self.grouplist.insert(END, g)
+ groupdict = m.groupdict()
+ for key in groupdict:
+ g = "%r: %r" % (key, groupdict[key])
+ self.grouplist.insert(END, g)
nmatches = nmatches + 1
if self.showvar.get() == "first":
break