http://www.perlmonks.org?node_id=1015464


in reply to regexp wizardry needed

Tested under 5.8 through 5.14:

>perl -wMstrict -le "my $currentyear = '2013'; my $lines2 = ' PERIOD 13 OCT 06 OCT'; ;; $lines2 =~ s{ (\d\d) \s ([[:upper:]]{3} (?! \S)) } {\u\L$2 $1, $currentyear}xmsg; print qq{$lines2}; " PERIOD Oct 13, 2013 Oct 06, 2013