I'm trying to use preg_match
to pick out two dates from a string (I can't guarantee the string will always be the same, but it will always contain two British dates). An example:
$row['status'] = "Client updated: renewal date changed from 31/01/2015 to 21/02/2015";
The regular expression I'm using worked in an online Regex tester, but I keep getting PHP errors when using it with preg_match
.
The initial error: Delimiter must not be alphanumeric or backslash
When I try to change it I get errors like: Unknown modifier '\'
I'm not great with regex, so any help will be apperciated.
$matches = array();
$pattern= '\d{2}/\d{2}/\d{4}';
preg_match($pattern, $row['status'], $matches);