What is wrong with this preg_match?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux