search a date

Yves Coppé yvescoppe at skynet.be
Mon Aug 5 08:57:01 CDT 2002


>
>Maybe there should be some additional tests for day (1-31) and month numbers
>(1-12)
>
>-- DD/MM/YY format
>function mi_searchDate textToSearch
>   local theDay, TheMonth, TheYear -- this is neccesary
>   put empty into tresult
>   repeat for each line theLine in textToSearch
>     if matchtext(theLine,
>"(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[12])/([0-9][0-9])", theDay, TheMonth,
>TheYear) is true then
>       put theLine & cr after tresult
>     end if
>   end repeat
>   delete last char of tresult
>   return tresult
>end mi_searchDate
>
>This avoids 32/05/02 as a valid date, but doesn't take care of leap years and
>real number of days in a month (januari : 31, february 28 or 29, ...)
>
>Jan
>


Thank you Jan, very useful addition !
-- 
Greetings.

Yves COPPE

Email : yvescoppe at skynet.be



More information about the use-livecode mailing list