On Fri, Jul 25, 2014 at 6:54 PM, Chris Knipe <sav...@savage.za.org> wrote:
> Hi All,
>
>
>
> I have the odd (very rare) case where I am given a date in an incorrect
> format.  I already use Date::Parse to convert the dates to a unix timestamp,
> and it’s working incredibly well.  However, on the rare case that I get
> incorrect dates, Date::Parse does not like them either and errors out.  The
> formats in question that I can’t parse basically looks like
>
>
>
> Thu, 23 Oct 2008 12:06:48+0400
>
>
>
> Note the lack of a space between the seconds and the timezone.
>
>
>
> Is there a simple quick way to fix that by means of a regex?

Depends on the data, of course. This might do the trick:

s/[0-9]\K\+/ +/

Or in maintainable form:

s<
  [0-9]   # A digit..
  \K       # (do not touch anything before this when replacing)
  \+       # ...followed by a plus sign
>< +>x;

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to