Matchtext

Yves COPPE yvescoppe at skynet.be
Thu Jul 31 08:25:01 EDT 2003


Hi list,


I received a few months ago a script from Ken to find a date in a fld

the date is supposed to be in french format :

dd/mm/yyyy


function 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[0-2])/([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 searchDate



BUT
I see in my text, some dates are
dd/mm/yyyy
and other :
  d/mm/yyyy

so first a space then the date of the day then "/" and then 2 digits  
for the month

as
31/07/2003
and
  1/08/2003

note the space before the 1/08/2003

the function above soesn't retrieve the last foramt of date

can someone adapt this function so that the fucntion retrieve the 2  
dates format ???


Thanks.


Greetings.

Yves COPPE
yvescoppe at skynet.be




More information about the use-livecode mailing list