in reply to Regular expressions extract, change num to word and capitalize each word after AU: tag and add 'written by'

To convert JULY to 06, you can use s/\bJULY\b/06/ (but you have to check the context, too). You can e.g. store all the months names in an array and then replace in a loop:
my @months = qw /january february march april may june july etc/; $x = 'january february march april may june july etc'; $x =~ s/\b\Q$months[$_]\E\b/sprintf '%02d',1+$_/e for 0 .. @months-1; print "$x\n";
  • Comment on Re: Regular expressions extract, change num to word and capitalize each word after AU: tag and add 'written by'
  • Select or Download Code