In article <[EMAIL PROTECTED]>, "David Veerasingam" <[EMAIL PROTECTED]> wrote:
> Can anyone explain why it won't give me my captured group? > > In [1]: a = 'exit: gkdfjgfjdfsgdjglkghdfgkd' > In [2]: import re > In [3]: b = re.search(r'exit: (.*?)', a) > In [4]: b.group(0) > Out[4]: 'exit: ' > > In [5]: b.group(1) > Out[5]: '' > > In [6]: b.group(2) > IndexError: no such group The ? tells (.*?) to match as little as possible and that is nothing. If you change it to (.*) it should do what you want. -- Doug Schwarz dmschwarz&urgrad,rochester,edu Make obvious changes to get real email address. -- http://mail.python.org/mailman/listinfo/python-list