in reply to Simple Regex needed
There are two simple ways of answering this question. One is to give you what you asked for: a regex to get the filename component from a UNIX-style path. That regex is m|(.[^/]+)$/ (Read: a bunch of non-slash characters (the maximum number possible, more or less), then the end of the string (with various caveats on exactly what the end of string means).
The other is to inform you of the right way to do it, which is to use File::Basename, which will do the right thing regardless of platform, and also makes the intent of your code more clear.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Simple Regex needed
by agentv (Friar) on May 08, 2003 at 20:52 UTC |