in reply to matching different date formats
No, that's not correct.
Besides the typos and the fact that you probably don't really want to eliminate whitespace or put non-date elements into your @dates array, your regex has some problems.
Working from the example you give, this might be a little closer to what you want:
my @dates; while (<FILE>) { while (m!(\d{2,4}[-/]\d{2}[-/]\d{2,4}|\w+\s+\d+\s+\d+)!g) { push @dates, "<date>$1</date>" } }
That could match a whole bunch of other stuff too though... If you can better explain what you need someone will almost surely give you something better than that.
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: matching different date formats
by imlou (Sexton) on Nov 09, 2002 at 00:17 UTC | |
by Enlil (Parson) on Nov 09, 2002 at 00:52 UTC |