in reply to $1

We've got a lot of duplication of data (since there are two possible regexes here), so let's pull the duplicate data into variables and have just one regex that tests both conditions. Also, we're going to use the /o modifier to ensure that the regex is compiled only once and therefore runs faster.
$month = '(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)? |Apr(?:il)?|May|Jun(?:e)? |Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)? |Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+'; $day = '[0-3]?[0-9](?:th|st|nd|rd)?,?\s+'; # I tossed an optional comm +a (,?) # in there in case we have +June 1st, 2000 $year = '[0-9]{2,4}'; opendir(DIRECTORY, $dir) or die "Can't open $dir: $!\n"; while($file = readdir DIRECTORY){ next if $file=~/^\./; $rfname=$dir . $file; open (CONT, $rfname); while (<CONT>){ if(/( (?:${day}${month}${year}) | (?:${month}${day}${year}) ) /ixo) { print "$1\n"; } } }
Regexes are bad enough. If we can use variable interpolation in them, it makes them much easier to grok.

Replies are listed 'Best First'.
RE: Re: $1
by Odud (Pilgrim) on Jun 21, 2000 at 22:56 UTC
    But what about Y10k compliance!