in reply to File finder
## # This isn't part of the core logic: we're just trying to make regexp # generation easy for admins with weak regex chops # The original use case used regexps to select files of interest. my @name_patterns = qw { *.conf$ ^ho ^net }; my @name_regexps = map { s/\./\\./g; s/\*/(\.+)?/g; qr {$_}; } @name_patterns;
The * glob pattern can match zero characters but you are replacing it with (\.+)? which has to match at least one character. Perhaps you want to use this instead: s/\*/(?s:.*?)/g; And don't forget the ? glob pattern which must match one character: s/\?/(?s:.)/g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File finder
by mpeever (Friar) on Oct 19, 2008 at 15:37 UTC | |
|
Re^2: File finder
by mpeever (Friar) on Oct 23, 2008 at 23:30 UTC |