Given a string and regex, how can I make sure it matches the entire string? That is, I don't want a newline to trigger the end of the match - I want it to match to the very end of the string.
Example:
<?php
// simplified date pattern
$pattern = "/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/";
$d = "2014-01-05
"; // OOPS - this will match
if(preg_match($pattern, $d)) {
echo "This is a date string.";
}