>I am trying to use a perl regular expression to validate a form field
>where I am allowing someone to edit a sql date-time stamp in the format
>of '2004-02-05 21:43:34'.

Just FYI, strtotime() provides date/time validation for free - check the
input using strtotime() and date('Y-m-d H:i:s') to get it in the form you
want.

An alternate, simpler PCRE would be:
        '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/'

Though note that unlike strtotime(), it won't tell you whether the date is
illegal.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html

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

Reply via email to