Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
PERL version 5.10 ======================== $lines2 = " PERIOD 13 OCT + 06 OCT"; $lines2 =~ /\d\d \w\w\w/g; $lines2 =~ s/(\d\d) (\w\w\w)/"\u\L$2 " . ($1 + 0)/eg; $lines2 =~ /(\w\w\w \d\d) \s+ (\w\w\w \d\d)/; print "dates: $1 and $2 \n"; #this line only works with 5.14. #push (@date, map { s/(\d\d) (\w\w\w)/"\u\L$2 " . ($1 + 0)/er } $lines +[2] =~ /\d\d \w\w\w/g); push (@date, $1); push (@date, $2); $date[0] = $date[0]. ", ". $currentyear; $date[1] = $date[1]. ", ". $currentyear;
Output:
dates: 06 and OCT
I need it to be
dates: Oct 06 and Oct 13
Code tags added by GrandFather
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regexp wizardry needed
by Kenosis (Priest) on Jan 25, 2013 at 17:11 UTC | |
by johngg (Canon) on Jan 25, 2013 at 23:24 UTC | |
by Kenosis (Priest) on Jan 26, 2013 at 00:44 UTC | |
|
Re: regexp wizardry needed
by LanX (Saint) on Jan 25, 2013 at 17:03 UTC | |
|
Re: regexp wizardry needed
by Anonymous Monk on Jan 25, 2013 at 17:06 UTC | |
by Corion (Patriarch) on Jan 25, 2013 at 17:13 UTC | |
by Anonymous Monk on Jan 25, 2013 at 18:03 UTC | |
by AnomalousMonk (Archbishop) on Jan 26, 2013 at 05:12 UTC | |
by LanX (Saint) on Jan 25, 2013 at 18:50 UTC | |
|
Re: regexp wizardry needed
by AnomalousMonk (Archbishop) on Jan 26, 2013 at 05:31 UTC |