matchChunk & matchText broken?
preid at reidit.co.uk
preid at reidit.co.uk
Sun Aug 15 03:54:13 EDT 2021
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? (preid at reidit.co.uk)
> 3. Re: matchChunk & matchText broken? (Brian Milby)
>
> ----------------------------------------------------------------------
>
> Message: 3
> Date: Fri, 13 Aug 2021 07:35:23 -0400
> From: Brian Milby <brian at milby7.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Re: matchChunk & matchText broken?
> Message-ID: <986D6545-2CA3-4C30-B65F-D3DDB2B183BE at 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 <use-livecode at lists.runrev.com> 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
More information about the use-livecode
mailing list