is a date

Yves COPPE yvescoppe at
Sun Oct 15 06:10:54 EDT 2017


I hope this works for any date format

on mouseUp

ask "Give a date"

if it is empty then exit to top

answer IsDate(it)

end mouseUp

function IsDate textToSearch

local theDay, TheMonth, TheYear

put empty into tresult

if matchtext(textToSearch,"(\d{1,2})/(\d{1,2})/(\d{2,4})",theDay,TheMonth,TheYear) is true then

put textToSearch into tresult


put "Invalid Date" into tresult

end if

return tresult

end IsDate

> Le 14 oct. 2017 à 21:52, J. Landman Gay via use-livecode <use-livecode at> a écrit :
> On 10/14/17 2:14 PM, Yves COPPE via use-livecode wrote:
>> Try this
>> function CheckDate pDateToCheck
>> return matchText(pDateToCheck,"([1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/([0-9][0-9][0-9][0-9])")
>> end CheckDate
> Promising, but fails with dates like "1/1/19".
> -- 
> Jacqueline Landman Gay         |     jacque at
> HyperActive Software           |
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the Use-livecode mailing list