regex (?!..) problem

Wolfgang Rohdewald wolfgang at
Mon Oct 5 08:17:54 CEST 2009

On Monday 05 October 2009, Carl Banks wrote:
> What you're not realizing is that if a regexp search comes to a
>  dead end, it won't simply return "no match".  Instead it'll throw
>  away part of the match, and backtrack to a previously-matched
>  variable-length subexpression, such as ".*?", and try again with a
>  different length.

well, that explains it. This is contrary to what the documentation
says, though. Should I fill a bug report?

Now back to my original problem: Would you have any idea how
to solve it?

count() is no solution in my case, I need to either
return None or a match.


More information about the Python-list mailing list