What is wrong with this preg_match?

From: Date: Thu, 27 Oct 2011 18:43:05 +0000
Subject: What is wrong with this preg_match?
Groups: php.general 
Request: Send a blank email to php-general+get-315451@lists.php.net to get a copy of this message
I have the following: if (isset($argc)) { if ($argc == 1 || $argc > 2 || !preg_match("(\d{4}-\d{2}-\d{2})", $argv[1])) { echo "\nUsage: $argv[0] <yyyy-mm-dd>\n\n"; exit; } else { $base_date = $argv[1]; } } else { $base_date = date('Y-m-d'); } When I run it: $ ./process_patches.php 201-01-01 Usage: ./process_patches.php <yyyy-mm-dd> patches@innm2 ~/Code/Oculi $ ./process_patches.php 2011-011-01 Usage: ./process_patches.php <yyyy-mm-dd> patches@innm2 ~/Code/Oculi $ ./process_patches.php 2011-01-011 Works.. What am I doing wrong? Thanks! -- Paul Halliday http://www.squertproject.org/

« previous php.general (#315451) next »