Trying to modify the code of a WoW addon: https://github.com/chocochaos/GMGenie to get more information from
The text it's something similar to this:
cff00ff00Ticket: 6969. cff00ff00Created by: Me cff00ff00Created: 57m32s ago cff00ff00Last change: 57m32s ago cff00ff00Ticket Message: [asd] cff00ff00Ticket Response: [answer 1
answer 2
answer3
]
I want to get the lines between the last brackets ([,]). This code gets only the first answer but ignores the other 2.
local response = string.match(arg1, "%|cff00ff00Ticket%sResponse%|r:%s%[(.*)");
This another code is working too: getting another vars:
local ticketId, name, createStr, lastModifiedStr, rest = string.match(arg1, "^%|cffaaffaaTicket%|r:%|cffaaccff%s([0-9]+).%|r%s%|cff00ff00Created%sby%|r:%|cff00ccff%s(.+)%|r%s%|cff00ff00Created%|r:%|cff00ccff%s([a-zA-Z0-9%s]+)%sago%|r%s%|cff00ff00Last%schange%|r:%|cff00ccff%s([a-zA-Z0-9%s]+)%sago%|r%s(.*)$");
I know the separators between lines are "\n".
I tryied to modify the (.*) pattern to add all the lines until the last bracket (]), using this:
local response, response2 = string.match(arg1, "%|cff00ff00Ticket%sResponse%|r:%s%\[(.*)+");
but it doesn't work. I don't know what is better: try to get all the characters in the same string and trim with gsub, or try to get any kind of array of strings. Could you help me?
After several hours of trying to solve this, I found that the server was sending me one response for each line of data. You cannot match or search anything outside the response variable...
At least not before concat the 3 responses. Really hard to do because each response starts a new code execution, because that addon code is used in a class that read each server response.
I will leave this as impossible to solve without rewrite the addon from scratch or rewrite the way the server lauches the responses.