in reply to filtering folder path using regex.
Your using a greedy regex '\\.+\\', which will grab as much as it can. You can either use a nongreedy version
$path =~ /^(\w):\\(.+?)\\?/;
Or better, match anything except the terminator char (\).
$path =~ /^(\w):\\([^\\]+)\\?/;
That said, you'd almost certainly be better of using the File::Spec module that is a part of the core for this sort of thing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: filtering folder path using regex.
by blackadder (Hermit) on Jul 13, 2003 at 14:30 UTC | |
by tcf22 (Priest) on Jul 13, 2003 at 18:55 UTC | |
by blackadder (Hermit) on Jul 14, 2003 at 20:57 UTC |