RegEx for a date

Ken Ray kray at
Fri Dec 20 17:04:01 EST 2002


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
[0-9][0-9])") is true then
    return pDateToCheck
    return "Bad date"
  end if
end CheckDate

Hope this helps,

Ken Ray
Sons of Thunder Software
Email: kray at
Web Site:

----- Original Message -----
From: "Yves Coppé" <yvescoppe at>
To: <use-revolution at>
Sent: Friday, December 20, 2002 3:35 PM
Subject: RegEx for a date

> Hi,
> I want to check if a line of a data is a date in European format :
> so I write
>   local theDay, TheMonth, TheYear
>   repeat for each line theLine in uneAnalyse
>            if
> is true then
>               put theLine into tDate
>              exit repeat
>            end if
>   end repeat
> but it doesn't work...
> Can someone help me please ???
> I think I write wrong for the "year" variable.
> Thanks.
> --
> Greetings.
> Yves COPPE
> Email : yvescoppe at
> _______________________________________________
> use-revolution mailing list
> use-revolution at

More information about the Use-livecode mailing list