Regular expression to find the date

Mike Bonner bonnmike at gmail.com
Thu Jan 5 12:30:54 EST 2012


Wow. Ok, ignore the one I sent.

On Thu, Jan 5, 2012 at 10:07 AM, Thierry Douez <th.douez at gmail.com> wrote:

> 2012/1/5 paolo mazza <mazzapaoloitaly at gmail.com>
>
> > Thank you Thierry,
> > your regular expression works. It was very kind of you.
> > All the best
> >
> > Paolo
> >
>
> Hi again Paolo,
>
> Just for fun...
>
> Look at this new Reg exp. below
> and see how it matches more precisely dates...
>
> felice anno nuovo !
>
> Thierry
>
>
> on mouseUp
>   -- Bad:
>   put "sfgsfg  35/01/2011 t trtr" into aString
>   put "sfgsfg  5/0/2011 t trtr" into aString
>   put "sfgsfg  5/10/1011 t trtr" into aString
>   -- Ok:
>   put "sfgsfg  05/01/2011 t trtr" into aString
>   put "sfgsfg  05-01-2011 t trtr" into aString
>   put "sfgsfg  05.01.2011 t trtr" into aString
>
>   -- put "((\d{2}|\d)/(\d{2}|\d)/(\d{4}|\d{2}))" into myRegEx
>
>   put "((0[1-9]|1[012])[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19|20)\d\d)"
> into myRegEx
>
>   put matchText( aString, myRegEx, theDate) into rslt1
>   put matchChunk( aString, myRegEx, pos1, pos2) into rslt2
>
>   get  format( "rslt1: %s \nrslt2: %s \nDate: %s      pos1: %s,  pos2:
> %s\n\n", \
>          rslt1, rslt2,  theDate, pos1, pos2 )
>
>   put IT
>
> end mouseUp
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list