Hi Roy,

--- Original Message
From: Zysman, Roiy <[EMAIL PROTECTED]>
Date: Sunday, July 18, 2004 at 01:14AM PDT

ZR> Is there a way to extract a filename out of a path string using just one
ZR> RegEx and not using the split function ?

ZR> For Example, I want to extract foo.txt from /my/long/path/foo.txt path
ZR> string.

I found this cool trick a while ago and it works nicely.

my($directory, $filename) = $text =~ m/(.*\/)(.*)$/;
print "D=$directory, F=$filename\n";

-MikeD


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to