Matchtext to find a series of words

J. Landman Gay jacque at hyperactivesw.com
Wed Nov 29 17:37:29 CST 2006


Jim Ault wrote:

> I would tackle this using the filter command
> 
> replace cr with tab in textStr
> set the wholematches to true
> filter textStr with "*"& token1&"*"
> filter textStr with "*"& token2&"*"
> filter textStr with "*"& token3&"*"
> if textStr  is empty then return false
> else return true
> 
> A better form would be
> 
> function allWordsPresent textStr, wordList
>   replace cr with tab in textStr
>   set the wholematches to true
>   repeat for each word WRD in wordList
>     filter textStr with ("*" & WRD & "*")
>   end repeat
>   return not (textStr is empty)
> end  allWordsPresent


This looks promising, thanks. It looks like there is no single-pass 
method, but since filter is pretty fast it may do okay. I didn't even 
quote your regex explanation, I don't want to touch it. :)

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list