Pattern Matching in Livecode
Alejandro Tejada
capellan2000 at gmail.com
Wed Nov 9 15:19:20 EST 2016
Hi Craig,
Your clever idea of reverting search terms works great too.
Many Thanks for answering my request! :D
I have posted a new stack and a screenshot
at the forum thread:
http://forums.livecode.com/viewtopic.php?f=7&t=28288
on mouseUp
put fld id 1008 into WL -- 12 words
put fld id 1014 into SC -- 1080 combinations
repeat for each line Q in SC
if lineoffset(word 1 of Q,WL) <> 0 and \
lineoffset(word 2 of Q,WL) <> 0 and \
lineoffset(word 3 of Q,WL) <> 0
then
put word 1 to 3 of Q & return after tCombinations
end if
end repeat
if the number of words of tCombinations > 2
then
-- delete last char of tCombinations -- a CR character
sort numeric descending tCombinations
put word 1 to -1 of tCombinations into fld id 1025
else
put "No matching set found" into fld id 1025
end if
end mouseUp
Still, I am curious to learn if regex and arrays operations
could produce the same results but faster.
Have a nice week!
Al
More information about the use-livecode
mailing list