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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.