Can one make 'in' ungreedy?

Dieter Maurer dieter at handshake.de
Mon May 18 12:08:56 EDT 2020


Chris Green wrote at 2020-5-18 11:50 +0100:
> ...
>So in the particular case where I have a problem sbstrip is "[Ipswich
>Recycle]" and the Subject: is "[SPAM] [Ipswich Recycle] OFFER:
>Lawnmower (IP11)".  The match isn't found, presumably because 'in' is
>greedy and sees "[SPAM] [Ipswich Recycle]" which isn't a match for
>"[Ipswich Recycle]".

`in` directly matches substrings; it is not greedy.


More information about the Python-list mailing list