Ich versuche, ein modifiziertes Preg-Format von preg_match: check birthday format (dd/mm/yyyy) zu verwenden, Kreditkarte Verfallsdaten (yyyy-MM-Formate)PHP preg_match ein Datumsformat "yyyy-MM"
if (!preg_match('/([0-9]{4})\-([0-9]{2})/', $expirationDate, $matches)) {
throw new Services_Payment_Exception('Card expiration date is invalid');
}
Aus irgendeinem Grund ist es auch passend validiere ungültige Werte wie 20111-02 (ungültiges Jahr). Was mache ich hier falsch? Ich möchte das Jahr 4 Ziffern bestätigen und der Monat 2 Ziffern (01, 02 .. 12)