Pattern Matching in Livecode

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Pattern Matching in Livecode

Alejandro Tejada
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:

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
         put word 1 to 3 of Q & return after tCombinations
      end if
   end repeat

   if the number of words of tCombinations > 2
      -- delete last char of tCombinations -- a CR character
      sort numeric descending tCombinations
      put word 1 to -1 of tCombinations into fld id 1025
      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!


use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences: