MatchChunk is true but positionVarsList is empty

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dntknwjck
Posts: 24
Joined: Sat Mar 23, 2019 6:14 pm

MatchChunk is true but positionVarsList is empty

Post by dntknwjck » Mon Feb 10, 2020 5:47 pm

Hello
Another day of frustration the trying to follow the Dictionary and not getting the expected results.
I have the following code in a mouseUp event and get the expected results with matchText, but matchChunk returns true with the positionVariable empty.
However offset using the variable from matchText does give me the position.
Any help is appreciated

Code: Select all

on mouseUp pButtonNumber
   local tStr, regX
   put "J<somtthing>Jan 31, 2020</span></td><td class=" into tStr
   put ">(Dec|Nov|Oct|Sep|Feb|Ma[ry]|A[up][gr]|J[au][nl])\s([0123]\d),\s(\d{4})" into regX
   get matchChunk(tStr, regX ,t2 )
   if matchText(tStr, regX ,t1 ) then
      wait 0
   end if
   if matchChunk(tStr, regX ,t2 ) then
      wait 0
   end if
end mouseUp

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: MatchChunk is true but positionVarsList is empty

Post by Thierry » Mon Feb 10, 2020 6:04 pm

Hi,

Please, try this...

Code: Select all

 
   local inputText, rex, catchedText, t1, t2

   put "J<something>Jan 31, 2020</span></td><td class=" into inputText
   put ">(Dec|Nov|Oct|Sep|Feb|Ma[ry]|A[up][gr]|J[au][nl])\s([0123]\d),\s(\d{4})" into rex
   
   if matchChunk(inputText, rex ,t1, t2 ) then
   	put  "Found: " & char t1 to t2 of inputText
   else
	put "No match!"
   end if

   if matchText(inputText, rex , catchedText ) then
	put "Found: " & catchedText
   end if
Regards,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

dntknwjck
Posts: 24
Joined: Sat Mar 23, 2019 6:14 pm

Re: MatchChunk is true but positionVarsList is empty

Post by dntknwjck » Tue Feb 11, 2020 1:33 pm

Thierry,
Thanks for the example I see the mistake I made.

Sure would be nice if the dictionary had examples like this.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”