re question

Schüle Daniel uval at rz.uni-karlsruhe.de
Wed Nov 1 17:48:48 CET 2006


Hello all,

I didn't found more appropriate news group for
this question, please let me know if there is ng with
regular expression as its main topic

I am trying to construct a case where a greedy and
non greedy operation produce different result.
I dont see the difference between 'a??b' and 'a?b'
As far I understand is that ? will first try to match a
(it's greedy) and only if it fails then it step back
and lets a unmatched. The other doesn't match a at first,
only if the pattern fails to match it steps back and match a.

But don't they do eventually the same thing?
Can someone provide an example where 2 patterns yield
different results.

Regards, Daniel



More information about the Python-list mailing list