RegEx question
Dar Scott
dsc at swcp.com
Sat Apr 10 03:33:23 EDT 2004
On Saturday, April 10, 2004, at 01:22 AM, Yves COPPE wrote:
> 09/10/2004 is a valid date in French
> function CheckDate pDateToCheck
> return
> matchText(pDateToCheck,"\A([1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/([0-
> 9][0-9][0-9][0-9])\z")
> end CheckDate
>
> it returns "false" and shoulf return "true"....
Oh, sorry, I was still concentrating on the \A and \z.
Maybe this will work:
function CheckDate pDateToCheck
return
matchText(pDateToCheck,"\A(0?[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/
([0-9][0-9][0-9][0-9])\z")
end CheckDate
It is not consistent yet as to whether the leading zero is optional.
It is optional for the day of the month, but required for the month.
Dar Scott
More information about the use-livecode
mailing list