I have a a feed who’s date is formatted like ‘D, d M Y G:i:s e’
Autoblogged has a reg expression engine.
What is the regular expression to convert ‘D, d M Y G:i:s e’ to ‘F j, Y’?
Again I want to convert ‘Fri, 20 Apr 2012 12:00:00 EST’ to ‘April 20, 2012’ where the date is stored in variable %:pubDate%. I’m using Autoblogged for WordPress.
Regex cannot convert strings, but it can find and parse them.
This regex will do what you want.
Put this in the “Search for” field (assuming that the dates are formatted exactly like
Fri, 20 Apr 2012 12:00:00 EST
):And this in the “Replace with” field:
See this for a demonstration: http://regex101.com/r/tP6hU7
You can then replace
Jan(?:uary)?
withJanuary
,Feb(?:ruary)?
withFebruary
,Input:
Fri, 20 Apr 2012 12:00:00 EST
Output:
April 20, 2012