Regex (matchChunk) help...
Mike Bonner
bonnmike at gmail.com
Fri Jun 15 13:51:55 EDT 2018
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
>
More information about the use-livecode
mailing list