vijesh has asked for the wisdom of the Perl Monks concerning the following question:
Hi Experts, Please help me here. I need to take substring (/fold1/fold2/fold3/) out of following one.
$str1="/fold1/fold2/fold3/file.pl" DB<48> p $str1 /fold1/fold2/fold3/file.pl DB<49> if ($str1 =~ m#([^/]+)$#) { print $1;} file.pl <<<< I managed to get my file name but need to get rest of th +e path. DB<50>
I need to print "/fold1/fold2/fold3/" in fact. what regexp will help me here? -Thanks, Vijesh
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex help
by McA (Priest) on Oct 20, 2014 at 07:11 UTC | |
by vijesh (Novice) on Oct 20, 2014 at 08:09 UTC | |
|
Re: regex help
by Athanasius (Archbishop) on Oct 20, 2014 at 07:17 UTC | |
by vijesh (Novice) on Oct 20, 2014 at 08:11 UTC | |
|
Re: regex help
by choroba (Cardinal) on Oct 20, 2014 at 10:04 UTC | |
by vijesh (Novice) on Oct 24, 2014 at 13:11 UTC |