the buggy regex in Python

Yingjie Lan lanyjie at yahoo.com
Fri Nov 26 01:05:46 CET 2010


--- On Thu, 11/25/10, MRAB <python at mrabarnett.plus.com> wrote:
> >
> Look at the spans:
> 
>  >>> for m in re.finditer('((.d.)*)*', 'adb'):
>     print(m.span())
> 
>     
> (0, 3)
> (3, 3)
> 
> There's an non-empty match followed by an empty match.

If you read my first post, it should be apparent that
that the empty string in the end of the string is 
used  twice -- thus an overlap.

Yingjie


      



More information about the Python-list mailing list