$re = '/(?:(Jan(?:uary)?)|(Feb(?:ruary)?)|(Mar(?:ch)?)|(Apr(?:il)?)|(May)|(June?)|(July?)|(Aug(?:ust)?)|(Sept(?:ember)?)|(Oct(?:ober)?)|(Nov(?:ember)?)|(Dec(?:ember)?))\s+(?:(\d{2})|(\d))\s+(\d{4})/i';
$str = 'created: October 4 1984 22:01 test';
$subst = "$15-${1:+01}${2:+02}${3:+03}${4:+04}${5:+05}${6:+06}${7:+07}${8:+08}${9:+09}${10:+10}${11:+11}${12:+12}-${13:+$13:0$14}";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php