in reply to Regex to extract last 3 components of filename
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;
|
|---|