develooper Front page | perl.perl6.language.regex | Postings from December 2000

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

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
December 15, 2000 13:48
Subject:
Re: Perl 5's "non-greedy" matching can be TOO greedy!
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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About