Monday, 19 August 2013

Using preg_match to get a date

Using preg_match to get a date

I have this string:
$dates = "Received: 6 April 2013; in revised form: 16 April 2013 /
Accepted: 25 April 2013 / Published: 15 May 2013"
I would like to get the date after the "in revised form", so 16 April 2013
in my example.
I have tryed something like this:
preg_match('/in revised form: ([^\/]*)/', $dates, $revisedDate);
But I am getting this result:
Array
(
[0] => in revised form: 16 April
2013
[1] => 16 April
2013
)
The year is somehow on a new line, so then I have a problem when trying to
use strtotime.
Any idea on what's the problem here ?

No comments:

Post a Comment