The perlre man page states:
By default, a quantified subpattern is "greedy", that is, it will match as many times as possible (given a particular starting location) while still allowing the rest of the pattern to match.
Hence, when trying the following simple program:
"abc" =~ /(a|ab)*(bc|c)/; print "$1 $2\n";
One would expect the output to be ab c. Executing the above program with Perl version 5.8.3 returns a bc however.
My question now is: which one is wrong, me, the man page or the implementation?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |