At 03:16 PM 8/9/01 -0700, I wrote:
>At 05:43 PM 8/9/01 -0500, [EMAIL PROTECTED] wrote:
>>Hi ,
>>
>>     Can anybody help me to write regex for date validation. The 
>> validation criterion will be as below,
>>
>>with date in format dd/mm/yyyy &
>>
>>dd - should be less than 31
>
>Really?  You're starting from 0?
>
>>mm - should be less than 12
>
>Ditto.
>
>>yyyy - no validation
>
>Not everything should be done with a single regex, even though anything 
>can be.  Here:
>
>         $date =~ m#^(\d\d)/(\d\d)/(\d{4})$/ && $1 < 31 && $2 < 12

Rats, hit Send too soon.  The delimiter is #, not /:

         $date =~ m#^(\d\d)/(\d\d)/(\d{4})$# && $1 < 31 && $2 < 12;
         # Now use date in ($1, $2, $3)
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to