matchChunk & matchText broken?
Brian Milby
brian at milby7.com
Fri Aug 13 07:35:23 EDT 2021
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
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list