in reply to Re: need regular expression
in thread need regular expression
This formula is simpler than the one earlier. The main
insight here is to avoid strings; it is better to use
arithmetic addition to construct the 'year' string (i.e. 20xx) .
for ( my @dates = qw( 4-10-31 14-11-31 ) ) { s/ ^ (\d{1,2}) ((?:-\d{1,2}){2}) $ /(2000+$1).$+/xe and print; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: need regular expression
by Perl Mouse (Chaplain) on Nov 02, 2005 at 11:13 UTC |
In Section
Seekers of Perl Wisdom