in reply to Need to capture an optional sub-directory name
but I am no regex pro
You don't need to become a "regex pro" -- whatever one of those is -- but you would sure save yourself some time in the long run, by making the effort to learn the basics:
$p = 'C:\Tools\scripts\Test\Unstable\Foo.pl';; $p =~ s[C:\\Tools\\scripts\\([^.]+).pl][$1]; $p =~ s[\\][ - ]g; print $p;; Test - Unstable - Foo $p2 = 'C:\Tools\scripts\Test\Foo.pl';; $p2 =~ s[C:\\Tools\\scripts\\([^.]+).pl][$1]; $p2 =~ s[\\][ - ]g; print $p2;; Test - Foo
|
|---|