"First match" (leftmost) trumps "shortest match" (anti-greedy). You can use a greedy .* to replace "leftmost (sub)match" with "rightmost (sub)match" to end up with "shortest match" in cases like this:
m{.*/(.*\.gz)$}
Note that it doesn't matter whether you make the part inside the parens greedy or not here.
- tye
In reply to Re: Why is this greedy matching? (leftmost)
by tye
in thread Why is this greedy matching?
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |