in reply to Re^2: String Matching
in thread String Matching
They are greedy, but not too clever
The quantifiers are greedy, but they refuse to let go of something they found unless forced even if they could get more someplace later.my $str = "xaxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; $str =~ /(a+)/; print "$1\n"; # prints "a" not "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: String Matching
by AnomalousMonk (Archbishop) on Aug 15, 2012 at 16:33 UTC | |
Re^4: String Matching
by Anonymous Monk on Aug 15, 2012 at 07:54 UTC | |
by frozenwithjoy (Priest) on Aug 15, 2012 at 15:31 UTC |
In Section
Seekers of Perl Wisdom