the buggy regex in Python

Yingjie Lan lanyjie at yahoo.com
Thu Nov 25 19:05:46 EST 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