in reply to Regex pattern to find directories only with digits
If I were trying to get just the entries in my current working directory whose names consist entirely of digits, I'd do it like this:
If the entries of interest were in fact all "yyyymmdd" digit strings, I'd replace the "+" in the grep regex with {8}.my @digit_dirs = grep /^\d+$/, <*>; print join( "\n", @digit_dirs, "" );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Regex pattern to find directories only with digits
by Bindo (Acolyte) on Jun 20, 2013 at 10:19 UTC | |
by gurpreetsingh13 (Scribe) on Jun 20, 2013 at 10:40 UTC |
In Section
Seekers of Perl Wisdom