Hope this helps ...

>perl -e '$str="/blabla/dir/nextdir/name.txt";
($path,$filenm)=$str=~m/(^.+)\/(\w+\.\w+$)/;
print "path=<$path>,file name=<$filenm>\n";'

path=</blabla/dir/nextdir>,file name=<name.txt>

John W Moon
-----Original Message-----
From: Bruno Veldeman [mailto:[EMAIL PROTECTED]]
Sent: June 09, 2001 16:08
To: [EMAIL PROTECTED]
Subject: Regex question


Hi,
 
I can't seem to get the regex right for this:
 
I have a string with this format "/blabla/dir/nextdir/name.txt"
I want only 'name.txt' in one string and the rest in another string.
 
It would be nice explaining the regex in plain english.
 
Or better, how do I learn to use regex?
 
For now it's like chineese to me.
(And I don't know chineese ;-) )
 
Thanks.

Reply via email to