At 07:44 2002.06.02, Zysman, Roiy wrote: >> -----Original Message----- >> From: Zysman, Roiy >> Sent: Sunday, June 02, 2002 2:40 PM >> To: '[EMAIL PROTECTED]' >> Subject: regexp help >> >> Hi all >> how do i catch the last segment of a path and file name >> for example i would like to catch only "test.gif" in /usr/src/test.gif or >> from /usr/src/test1/../.../..../test.gif >> 10x >>
with regex, something like /([^/]*)$/ should work. This looks for any character except the '/' at the end of the string and store the result in $1. Note that /foo/bar/ would match an empty string since the path ends with a '/'. Myself, I prefer to use the File::Basename module. perldoc File::Basename for more information. Best ----------------------------------------------------------- �ric "Space Monkey" Beaudoin >> In space, no one can hear you sleep... <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
