Matchtext for multiple words

Eric Chatonet eric.chatonet at sosmartsoftware.com
Wed Nov 29 17:19:11 EST 2006


Hi Jacque,

Are you sure you need a regex? ;-)

function AreWordsIn pText,pWords
   repeat for each word tWord in pWords
     if space & tWord & space is not in pText then return false
   end repeat
   return true
end AreWordsIn

As this way of doing searches for words that are not in the text, it  
should be very fast...

Le 29 nov. 06 à 22:39, J. Landman Gay a écrit :

> 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?


Best Regards from Paris,
Eric Chatonet
------------------------------------------------------------------------ 
----------------------
http://www.sosmartsoftware.com/    eric.chatonet at sosmartsoftware.com/





More information about the use-livecode mailing list