- or download this
$ perl -E 'my $c = reverse "/foo/bar/baz/bat"; say "matched ", scal
+ar reverse ($1) if $c =~ m{(.+?)/};'
matched bat
- or download this
$ perl -E 'my $c = "/foo/bar/baz/bat"; say "matched $1" if $c =~ m{/
+(\w+)$};'
matched bat
- or download this
$ perl -E 'my $c = "/foo/bar/baz/bat"; say "matched $1" if $c =~ m{/(
+[^/]+)$};'
matched bat