Page 1 of 1

Wildcard Limit

Posted: Sat Jan 25, 2014 6:56 am
by Jaren
I noticed that there seems to be a limit to how many wildcards you can parse from the matches table. So far, the limit I have found is 33. I have a unique situation where I have set it up so my MUD is sending the player information via a large one line array (Example below) and I need to do something with the gui elements in my plugin for each and every segment of it. Is there a better way to parse this? Is there some feature I could use to simplify this? Keep in mind that some things shown may sometimes be numbers or words and they flip flop back n forth, but the place in the array remains constant.

Here is an example of what I am matching:

Code: Select all

%%%CG,2034,0,0,0,0,0,0,0,6,8,0,0,0,3,1,random,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,Rook Parlour,55.7,4250,0,%SKStealth: 345.065 (82910 sec) 2.5%SKDodge: 1173.0 (45510 sec) 0.343CG%%%
Here is an example of the regular expression trigger I am using to match it:

Code: Select all

^\%\%\%CG\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)CG\%\%\%$
If I cut it down to 33 wildcards it works, anything higher and it still matches but can no longer parse the wildcards. I would appreciate any ideas or suggestions you folks have in mind.

Re: Wildcard Limit

Posted: Sat Jan 25, 2014 2:00 pm
by Jor'Mox
Well, I think that first you should check to see if the issue is with the pattern size, or with the actual matches. So you should be able to cut down the pattern size like this, while still capturing everything as individual matches:

Code: Select all

^\%\%\%CG(?:\,(.*?))+CG\%\%\%$
If that doesn't work, you could always just do this:

Code: Select all

^\%\%\%CG\,(.*)CG\%\%\%$
And then parse the single match manually, like this:
Code: [show] | [select all] lua
local matchTbl = {}
for w in string.gmatch(matches[2],"[^,]+") do
   table.insert(matchTbl, w)
end

Re: Wildcard Limit

Posted: Sat Jan 25, 2014 6:19 pm
by Jaren
Thanks, I was looking for a way to parse it out internally and that worked like a charm. Now I just need to adjust it a bit to work with the skills section at the end but I have enough here to figure it out.

Re: Wildcard Limit

Posted: Sat Jan 25, 2014 7:26 pm
by Vadi
I think it is the pattern size and generally the fact that it is very dodgy. The one that loops the captures seems to get everything fine:
Code: [show] | [select all] lua
{
"%%%CG,2034,0,0,0,0,0,0,0,6,8,0,0,0,3,1,random,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,Rook 
Parlour,55.7,4250,0,%SKStealth: 345.065 (82910 sec) 2.5%SKDodge: 1173.0 (45510 sec) 0.343CG%%%",
"%SKStealth: 345.065 (82910 sec) 2.5%SKDodge: 1173.0 (45510 sec) 0.343"
}