I have a string:
$string = "Created on: 06-Sep-08";
I would like to match the date and convert it to 06/09/2008; what is the needed regexp?
Thanks
$matches = array();
preg_match('/(\d{2})-(\D*)-(\d{2})/', $string, $matches)
This returns the array matches.
$matches[0] will contain the text that matched the full pattern, $matches[1] will have the text that matched the first captured parenthesized subpattern, and so on
preg_match('/\:.*/is',...);
And then do a
strtotime(...)
EDIT:
Forgot to add the parantheses
preg_match('/\:(.*)/is',$string,$matches);