|
Posted by Frank Seitz on March 10, 2008, 4:26 am
Please log in for more thread options
Deepan - M.Sc(SE) - 03MW06 wrote:
> I am having a string like below:
>
> $str="/a/b/c/"; (or) $str = "/a/b/c/d/";
>
> What i need is that i should always be able to extract "c" from the
> above strings. I should not use split. Only by using regular
> expressions i should be able to achieve this. Please help me to solve
> this.
($val) = $str =~ m|/([^/]+)/$|;
$ perldoc perlrequick
$ perldoc perlretut
$ perldoc perlre
Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/ Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel
|