Re: matchChunk & matchText broken?
Thanks Brian I didn't realise that was what was meant in the dictionary description! Now you've clarified things I can see how it should work, and it does! > Today's Topics: > > 1. PlayStore App Bundles. (Ralph DiMola) > 2. matchChunk & matchText broken? (pr...@reidit.co.uk) > 3. Re: matchChunk & matchText broken? (Brian Milby) > > -- > > Message: 3 > Date: Fri, 13 Aug 2021 07:35:23 -0400 > From: Brian Milby > To: How to use LiveCode > Subject: Re: matchChunk & matchText broken? > Message-ID: <986d6545-2ca3-4c30-b65f-d3ddb2b18...@milby7.com> > Content-Type: text/plain; charset=utf-8 > > If the regularExpression includes a pair of parentheses, the position of the > substring matching the part of the regular expression inside the parentheses > is placed in the variables in the positionVarsList. > > Sent from my iPhone > >> On Aug 13, 2021, at 4:33 AM, Peter Reid via use-livecode >> wrote: >> >> ?Either I'm doing something wrong or both matchChunk and matchText are >> broken. >> >> For example using matchChunk: >> >> local tStartPos, tEndPos >> put empty into tStartPos >> put empty into tEndPos >> >> put matchChunk("hello world how are you", "\ ho[a-z]", tStartPos, tEndPos) >> into itMatches >> >> put itMatches & "|" & tStartPos & "|" & tEndPos & "|" >> >> >> The output is:true|||- in other words a match is found but the >> positions are not being returned in the variables tStart and tEnd >> >> I get the same behaviour from matchText, ie it correctly finds or not the >> patterns I'm looking for but I don't get the positions (matchChunk) or text >> (matchText). >> >> These seem to be fairly fundamental and frequently used functions that >> should just work. Which is why I'm assuming that I'm doing something wrong! >> >> Please can anyone correct me (or confirm the fault)? >> >> Thanks >> >> Peter >> -- >> Peter Reid >> Loughborough, UK ___ 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
Re: matchChunk & matchText broken?
If the regularExpression includes a pair of parentheses, the position of the substring matching the part of the regular expression inside the parentheses is placed in the variables in the positionVarsList. Sent from my iPhone > On Aug 13, 2021, at 4:33 AM, Peter Reid via use-livecode > wrote: > > Either I'm doing something wrong or both matchChunk and matchText are broken. > > For example using matchChunk: > > local tStartPos, tEndPos > put empty into tStartPos > put empty into tEndPos > > put matchChunk("hello world how are you", "\ ho[a-z]", tStartPos, tEndPos) > into itMatches > > put itMatches & "|" & tStartPos & "|" & tEndPos & "|" > > > The output is:true|||- in other words a match is found but the > positions are not being returned in the variables tStart and tEnd > > I get the same behaviour from matchText, ie it correctly finds or not the > patterns I'm looking for but I don't get the positions (matchChunk) or text > (matchText). > > These seem to be fairly fundamental and frequently used functions that should > just work. Which is why I'm assuming that I'm doing something wrong! > > Please can anyone correct me (or confirm the fault)? > > Thanks > > Peter > -- > Peter Reid > Loughborough, UK > > > ___ > 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
matchChunk & matchText broken?
Either I'm doing something wrong or both matchChunk and matchText are broken. For example using matchChunk: local tStartPos, tEndPos put empty into tStartPos put empty into tEndPos put matchChunk("hello world how are you", "\ ho[a-z]", tStartPos, tEndPos) into itMatches put itMatches & "|" & tStartPos & "|" & tEndPos & "|" The output is: true||| - in other words a match is found but the positions are not being returned in the variables tStart and tEnd I get the same behaviour from matchText, ie it correctly finds or not the patterns I'm looking for but I don't get the positions (matchChunk) or text (matchText). These seem to be fairly fundamental and frequently used functions that should just work. Which is why I'm assuming that I'm doing something wrong! Please can anyone correct me (or confirm the fault)? Thanks Peter -- Peter Reid Loughborough, UK ___ 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