RegEx for a date
yves COPPE
yvescoppe at skynet.be
Sat Dec 21 03:45:01 EST 2002
>Yves,
>
>A couple of things... first, you are missing the key function call to
>"matchText" in your regex call; secondly, you don't need to provide
>additional variables for theDay, theMonth and theYear unless you are
>planning on doing something with them later on (i.e. you don't need them
>just for verification); and finally, you are exiting the repeat loop as soon
>as you find a good date (I'm not sure if this is what you want). Your
>original post said you just wanted to check to see if a line of data is in
>the right format, so I removed the repeat loop (you can put it back in if
>you're checking a list of dates).
>
>Here's what worked for me (verification on one line only):
>
>function CheckDate pDateToCheck
> if
>matchText(pDateToCheck,"(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/([0-9][0-9]
>[0-9][0-9])") is true then
> return pDateToCheck
> else
> return "Bad date"
> end if
>end CheckDate
>
Thank you very much for the lesson and the solution...!!!
Cheers
--
Greetings.
Yves COPPE
Email : yvescoppe at skynet.be
More information about the use-livecode
mailing list