Greedy quantifiers



examples/regex-perl/greedy.pl
use strict;
use warnings;

'xaaab' =~ /xa*/;
print "$&\n";

'xabxaab' =~ /xa*/;
print "$&\n";

'xabxaab' =~ /a*/;
print "$&\n";
/xa*/ on xaaab xaaa because it is greedy /xa*/ on xabxaab xa at the beginning even though the other one is longer /a*/ on xabxaab the empty string at the beginning of the string