[Python-Dev] Some questions about maintenance of the regular expression code.
Gary Herron
gherron@islandtraining.com
Wed, 26 Feb 2003 11:07:42 -0800
On Wednesday 26 February 2003 10:39 am, Fred L. Drake, Jr. wrote:
> M.-A. Lemburg asked:
> > Hmm, could you explain where ".*?" is useful ?
>
> Gary Herron responded:
> > Yes, easily. It's the non-greedy version of "match all". The manual
> > page for the re module has this nice example:
>
> I think the problem is that .*? is too similar to (.*)? -- especially
> for people who aren't familiar with the non-greedy versions of the
> operators. This certainly stumped me as well.
>
> I'm not sure what can be done about that, though.
It stumped my for a while also, even though I've used them on
occasion. In general I find regular expressions mostly unreadable.
Solutions for that problem would occupy a (probably long and hopefully
different) thread.