Date Valadation and MatchText

Jeff Honken jhonken at x12.info
Wed Dec 21 18:33:12 EST 2005


I've been trying to write some error coding for a text field containing
a date.  I found some old code that someone wrote in the past but I'm
having a hard time figuring out how it's working.  I'm trying to get the
code so if the Year is 5 digits it gets flagged as a bad date.  The
pattern I'm trying to check is:  mm/dd/yyyy  

Here's the Code:

function CheckDate pDateToCheck
  if
matchText(pDateToCheck,"(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])/([0-9][
0-9][0-9][0-9])") is true
  then
    return pDateToCheck
  else
    return "Bad date"
  end if
end CheckDate







More information about the use-livecode mailing list