Some more odd behaviour from the Regexp library

David Veerasingam vdavidster at gmail.com
Wed Oct 19 23:10:43 EDT 2005


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




More information about the Python-list mailing list