Reputation: 977
I'm currently trying to find out if a date is in the format of YYYY-DD-MM
.
In PHP, I've got this:
if (preg_match('(\d{4})(-)(\d{2})(-)(\d{2})$', $newDateOfBirth))
However I keep getting the following error:
Warning: preg_match(): Unknown modifier '(' in C:\webserver\webroot\index.php on line 105
Upvotes: 0
Views: 651
Reputation: 1299
You are missing the delimiters:
if (preg_match('~(\d{4})(-)(\d{2})(-)(\d{2})$~', $newDateOfBirth))
Upvotes: 1