Slightly cleaned up, and adjusted to empty tPair after a match. (on the off chance there is a second ending without a matching new beginning word)
> on mouseup > put the text of field 1 into tText > put "beginning" into tstartword -- string begin > put "ending" into tEndword -- string end > put 1 into tCounter -- tracks current word > repeat for each trueword tWord in tText > switch tWord > case tStartword > put tCounter into tPair > break > case tEndword > if tPair is not empty then > put tPair & comma & tCounter & cr after tPairs > put empty into tPair > end if > break > end switch > add 1 to tcounter > end repeat > delete the last char of tPairs > repeat for each line tLine in tPairs > set the textcolor of trueword (item 1 of tLine) to (item 2 of tLine) > of field 1 to "blue" > end repeat > end mouseup > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode