Wildcard Limit

Post Reply
Jaren
Posts: 21
Joined: Sun Nov 17, 2013 1:55 pm

Wildcard Limit

Post 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.

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: Wildcard Limit

Post 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

Jaren
Posts: 21
Joined: Sun Nov 17, 2013 1:55 pm

Re: Wildcard Limit

Post 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.

User avatar
Vadi
Posts: 4826
Joined: Sat Mar 14, 2009 3:13 pm

Re: Wildcard Limit

Post 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"
}

Post Reply