Re: Perl 5's "non-greedy" matching can be TOO greedy!

[email protected] (Tom Christiansen) Fri, 15 Dec 2000 14:48:43 -0700
Newsgroups perl.perl6.language.regex
Message-ID <17457.976916923@chthon>
And while I'm at it, consider /(.*)(.*)(.*)/, which we'll call
/ABC./  You need to be able to say all of these independently
and in conjunction with one another:

    whether segment A   is longest or shortest overall 
    whether segment  B  is longest or shortest overall 
    whether segment   C is longest or shortest overall 

    whether segment AB  is longest or shortest overall 
    whether segment  BC is longest or shortest overall 

    whether segment ABC is longest or shortest overall 

Imagine wanting, in /ABC/, A and B to be minimal, C to be maximal,
AB to be maximal, BC to be minimal, and ABC to be maximal.

Does this not strike fear into your heart?  The very notation we'd
have to devise should itself be plenty sufficient to give you serious
pause--and that's not even considering the heat-death problem of
guaranteed worst-case behavior that the word "overall" mandates.

Be very afraid.
--tom