Mark Byerley wrote:
> 
> Good Morning/Afternoon to all
> 
> I need some error checking (or rather field validation) within my script
> itself to ensure a date field coming across on a form is in the format of
> dd-mm-yyyy. I would rather not have to strip the field down to check the
> individual numbers and then put them back together again. Is there any
> "simple" type of error checking I can use in this instance? I appreciate the
> help.
> Thank you
> M~

How about pattern matching?

if ($theDate !~ m/\b(0[1-9]|[1-2][0-9]|3[01])-(0[1-9]|1[0-2])-\d{4}\b/)
{
        reject ...
} else {
        celebrate ...
}

Note that my year validation is somewhat less robust than my month and
day validation. :-)

Daniel

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

Reply via email to