On 10 Jun 2005, at 20:38, Michael Chermside wrote: > David Reitter writes: > >> Why does the following result in an IndexError? >> > [...] > >>>>> import re >>>>> m = re.match('(?P<m>maybe)?yes', "yes") >>>>> m.group(1) >>>>> m.group('maybe') >>>>> >> Traceback (most recent call last): >> File "<stdin>", line 1, in ? >> IndexError: no such group >> > > Because the name of the named group in your example is 'm' not > 'maybe'. 'maybe' > is the text to match.
Oh shoot! how couldn't i see this! thanks very much for pointing it out... - D -- http://mail.python.org/mailman/listinfo/python-list