in reply to Re: Extracting file name from path
in thread Extracting file name from path
That will extract all the information after the last \. Using the .*? version it would have to be:/^.*\\(.*)/
This would aslo make it a lot slower./.*?\\(?!.*\\)$/
However, trying to find the last \, like in this example, could probably be made simpler by a call to reverse. Though, in the example of extracting a filename, definately you should use a module like File::Basename, as aforementioned. This way it will be portable accross systems, and it is tested for errors, so it will save you valuable time trying to fix a regex that has something wrong with it(and errors always slip in, as do special cases).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Extracting file name from path
by srawls (Friar) on Jun 15, 2001 at 05:21 UTC |