Regular expression to find the date

Thierry Douez th.douez at gmail.com
Wed Jan 11 06:59:17 EST 2012


Hi Paolo,

Both of these solutions work great.
> However, to me,  a perfect solution would be a combination of the two,
>
> A Regular Expression that accept
>
> 05/01/2011
> 05-01-2011
> 05.01.2011
> ...
> and also
>
> 11/9/2011
> 5/10/2011
> ...
> as a date.
>

If you need an optional '0' for one digit day and month, add
a question mark after the 0 in the Regexp, like this :

   put
"((0?[1-9]|[12][0-9]|3[01])[-/.](0?[1-9]|1[012])[-/.]((19|20)\d\d))"  into
myRegEx


HTH,

Thierry



More information about the use-livecode mailing list