/\/(\w+)\/foo$/
Perhaps better as:
m!/([^/]+)/foo$!
Advantages:
- Uses "choose your own quotes" to avoid falling-toothpick syndrome.
- Some systems allow some funky characters that \w won't match. However, '/' certainly won't be in a filename (unless something really, really weird happens).
---- I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
| [reply] [d/l] [select] |
| [reply] |
By "slash", I think you meant only forward-slash '/' since '\' is legal for my UFS (OpenBSD) file system and I recall that its fine for Linux (when I last used it eons ago). Both '/' and '\' are illegal for the various Microsoft filesystems. Both '/' and '\' are legal in the Mac file systems except there ':' is reserved. *grin* aint it fun? I just use File::Spec and hope for the best.
| [reply] |
On other systems than those, all bets are off; I wouldn't be surprised if the slash was a valid part of filenames on something "weird" like VMS.
Nope. VMS is very strict unless things changed in ODS-5 (I haven't worked with V7). ODS-2 only allows upper case alpha, numeric, dollar sign, underscore and hyphen. Slashes in either direction are definitely out. Filenames can have a 39 character name and a 39 character type separated by a period. Older versions of VMS only allowed 9.3 filenames.
90% of every Perl application is already written. ⇒ | dragonchild |
| [reply] |