Matchtext for multiple words

John Craig jc at spl21.net
Wed Nov 29 21:15:32 EST 2006


J. Landman Gay wrote:
> John Craig wrote:
>> And a script to create the regex from a word list.  My apologies if 
>> this stuff turns out useless - but you can get absorbed in this mince...
>
> I passed three random words to your script (list,house,dog) and got 
> this regex from it:
>

Here is the correct regex I get when I substitute your new words into 
the script (check that list is passed as "list|house|dog")
(?is)\b(list|house|dog)\b.*\b(?!\1)(list|house|dog)\b.*\b(?!\1|\2)(list|house|dog)\b

a few bits missing from the one below!
> (?is)\b(list|house|dog)\b\b(?!\1)(list|house|dog)\b\b(?!\1|\2)(list|house|dog)\b 
>
>
> My test then goes through a bunch of text files on disk and applies 
> the regex to the text of each file like this:
>
> put matchText(tText, tRegex) into tMatch
>
> I don't get any matches though, and my knowledge of regex is too 
> limited for me to know if I'm doing something wrong. Does this look 
> right to you? I think there should have been at least 2 matching files 
> (that's what some of the other scripts produced.)
>




More information about the Use-livecode mailing list