I'm not very good with expressions... I've looked at some online tutorials, but I'm still not getting it. Basically, I'm trying to return TRUE if a string is formatted like this: 4 digits + space + 2 digits and convert it to a date.
So, the string will look like: 2010 02, and I'm trying to output February, 2010.
I'm trying to use preg_match, but I keep getting { is not a modifier...
EDIT
Per the first 2 responses, I changed it, but am getting a fatal error on the first and the same unknown modifier error on the second:
if(preg_match('/([0-9{4}]) ([0-9]{2})/iU',$path_part)) {
$path_title = date("F, Y",strtotime(str_replace(" ","-", $path_title)));
}
Also, just tried the more in-depth version in the first response, and while the error goes away, it doesn't change the output...
$path_part = '2010 02';
if(preg_match('/^(\d{4}) (\d{2})$/',$path_part,$matches)) {
$path_title = $mon[(int)$matches[2]] . " " . $matches[1]; // prints Feb 2010
}