|P is for Practical|
Regular Expression Helpby Anonymous Monk
|on Nov 18, 2005 at 19:50 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
Let's say you have a directory:
How would I strip off JUST the last subdir, sub4? Of course, the dir could be called anything, like "/rootdir/sub funky ---doodash/la la la/Proposal for Buttering My Feet" and I would still want to strip off "Proposal for Buttering My Feet", and be 5 or more times long.
Any idea? I figure it's a reg ex like "Look for the last / that isn't the last character and take away everything to the right of it, including itself"
Thanks very much!!!!