Glad it worked. If it turns out there is a reason not to use trueword and a for each loop, the same basic algorithm can be used with offset() but it would be a bit more convoluted. Basically, find the first offset for the beginning string, then use that to skip chars to look for both the beginning string and ending string. If both are found, replace the initial offset for beginning with the new offset, use that info for the next chars to skip, and do it again.
There would be several more things to watch for, like having a current beginning offset, doing your check, and making sure you still have a match even if there isn't another beginning offset, and only an end. (and various other combinations i'm sure) but it shouldn't be too bad to figure out if the other solution is ruled out for some reason. On Fri, Jun 15, 2018 at 12:32 PM Glen Bojsza via use-livecode < use-livecode@lists.runrev.com> wrote: > Hi Mike, > > Yes this works....never used or knew about trueword. > > thanks! > > Glen > > On Fri, Jun 15, 2018 at 1:21 PM, Mike Bonner via use-livecode < > use-livecode@lists.runrev.com> wrote: > > > Try this.. > > > > on mouseup > > local tCharOffset > > --set the text of field 1 to the text of field 1 > > 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 > > 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 > > > > On Fri, Jun 15, 2018 at 11:03 AM Glen Bojsza via use-livecode < > > use-livecode@lists.runrev.com> wrote: > > > > > Mike, I believe that you are correct in understanding what I am trying > to > > > extract. > > > > > > I will need a bit more time to work through your solution. > > > > > > regards, > > > > > > Glen > > > _______________________________________________ > > > 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 > > > > > _______________________________________________ > > 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 > > > _______________________________________________ > 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 > _______________________________________________ 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