Matchtext for multiple words

John Craig jc at
Wed Nov 29 19:05:05 EST 2006

Maybe I'm too tired....  but I think this works.

on mouseUp
  put "The purple dinosaur inadvertently stepped on the cat." & return & 
"The white dog howled." into tString
  put "The purple dinosaur inadvertantly stepped on the cat." & return & 
"The white cat howled." into tString2
into tReg
  put matchText(tString, tReg, tMatch1, tMatch2, tMatch3) into tResult
  put matchText(tString2, tReg, tMatch4, tMatch5, tMatch6) into tResult2
  answer tResult && tMatch1 && tMatch2 && tMatch3 & return & tResult2 && 
tMatch4 && tMatch5 && tMatch6
end mouseUp

J. Landman Gay wrote:
> Sorry if this comes through twice, I'm having trouble sending to the 
> list.
> I need a matchtext/regex that will tell me if all supplied words exist 
> in a block of text, regardless of their order, and ignoring carriage 
> returns.
> For example, see if all these words:  dog dinosaur cat
> exist in this text:
> "The purple dinosaur inadvertently stepped on the cat.<cr>
> The white dog howled."
> Should return true. Is there such a thing?

More information about the Use-livecode mailing list