I would just modify any single digits before parsing.
johngg@shiraz:~/perl/Monks$ perl -Mstrict -Mwarnings -E ' my @dateStrs = ( q{Fri May 8, 2020 - 11:12:13}, q{Fri May 15, 2020 - 14:08:17}, q{Sat May 16, 2020 - 7:31:22}, q{Mon Jun 1, 2020 - 6:24:18}, ); s{(?<=\D)(\d)(?=\D)}{ sprintf q{%02d}, $1 }eg for @dateStrs; say for @dateStrs;' Fri May 08, 2020 - 11:12:13 Fri May 15, 2020 - 14:08:17 Sat May 16, 2020 - 07:31:22 Mon Jun 01, 2020 - 06:24:18
Perhaps the problem is more complex than stated in the OP but this seems to work.
Update: A version that copes properly with extra spaces, the first version didn't.
johngg@shiraz:~/perl/Monks$ perl -Mstrict -Mwarnings -E ' my @dateStrs = ( q{Fri May 8, 2020 - 11:12:13}, q{Fri May 15, 2020 - 14:08:17}, q{Sat May 16, 2020 - 7:31:22}, q{Mon Jun 1, 2020 - 6:24:18}, q{Fri May 8, 2020 - 11:12:13}, q{Fri May 15, 2020 - 14:08:17}, q{Sat May 16, 2020 - 7:31:22}, q{Mon Jun 1, 2020 - 6:24:18}, ); s{(\s+\d)(?=\D)}{ sprintf q{ %02d}, $1 }xeg for @dateStrs; say for @dateStrs;' Fri May 08, 2020 - 11:12:13 Fri May 15, 2020 - 14:08:17 Sat May 16, 2020 - 07:31:22 Mon Jun 01, 2020 - 06:24:18 Fri May 08, 2020 - 11:12:13 Fri May 15, 2020 - 14:08:17 Sat May 16, 2020 - 07:31:22 Mon Jun 01, 2020 - 06:24:18
Cheers,
JohnGG
In reply to Re: Parsing Timestamp with extra spaces
by johngg
in thread Parsing Timestamp with extra spaces
by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |