On 11/29/06 1:39 PM, "J. Landman Gay" <[EMAIL PROTECTED]> wrote:
> 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? Since Rev says "cat" and "cat." are different words, punctuation poses a problem. Here's an approach that's simple and fast but depends on the programmer to include a replace statement for each punctuation mark. -- Dick on mouseUp put "" put "The purple dinosaur inadvertently stepped on the cat." & cr \ & "The white dog howled." into tText put "dog dinosaur cat" into tWords putLines textContainsAllWords(tText,tWords) end mouseUp function textContainsAllWords tText,pWords replace "." with space in tText replace "," with space in tText repeat for each word tWord in tText put 1 into tArray[tWord] end repeat repeat for each word tWord in pWords if tArray[tWord] is empty then return "false" end repeat return "true" end textContainsAllWords _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution