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:25
Subject:
Re: Perl 5's "non-greedy" matching can be TOO greedy!
Message ID:
10500.976915524@chthon
>That would be a strange regexp, but I never suggested it.  I suggested the
>regexp /b.*?d/ and pointed out that I believe "bccccd" is a more intuitive
>match than "bbbbccccd".  That was the matching text, not the regexp, sorry
>if I didn't make that clear.

Fine.  What you said is 

    first
	find a b
    then 
	find any non-newline, repeated 0 to N times
    then 
	find a d

What part of "first find a b" do you expect a randomizing solution to?
That's very clear.

--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