in reply to This regular expression has me stumped
Not every problem is best solved with a big fat regex.
while (my $line = <FILE>) { my @files = map { m!/([\w\.\-]+)\W*$!; $1 } grep { m!/! } split ' ', $line; # blah }
The logic goes split on whitespace, ignore all tokens that don't have a file path sep / with , then get the last bit after the / up to the end or optional \W* using map. The character class [\w\.\-] should match most filenames. Normally I would use [^/] but this is problematic in this case. Should work on your data as described.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: This regular expression has me stumped
by tsk1979 (Scribe) on May 01, 2008 at 09:08 UTC | |
by tachyon-II (Chaplain) on May 01, 2008 at 09:52 UTC | |
by goibhniu (Hermit) on May 01, 2008 at 15:24 UTC | |
|
A no-op in this map block: was Re^2: This regular expression has me stumped
by Narveson (Chaplain) on May 01, 2008 at 22:59 UTC | |
by tachyon-II (Chaplain) on May 02, 2008 at 09:17 UTC |