in reply to Regex to extract last 3 components of filename

If you don't want to match a slash, tell Perl about it:
m{/([^/]*?)/([^/]*?)/([^/]*?)\.([a-z0-9]+?)$}

The problem can be solved using split in a much cleaner way:

my @parts = (split m{/}, '/x/y/z/a/b/c/d/e.f'); splice @parts, 0, -3; push @parts, split /\./, pop @parts; print "<$_>" for @parts;

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]