I have problem with correctly parse strings with items name.
Example chat message catched by mm:
Code: Select all
SELL1 |Hitem:3466e 3 141264 c998c9d4 c844ca38 c9c0c9fc 7f26a 7f242 7f454 7f206 45e5 a498|h|cffa37d50[ITEMNAME1]|r|h SELL2 |Hitem:334ac 3 141264 c998c9d4 c844ca38 c9c0c9fc 7f26a 7f242 7f454 7f206 45e5 a498|h|cffa37d50[ITEMNAME2]|r|h
Code: Select all
local parsemsg = str:gsub("|Hitem:.-|h|(%x+)","")
local parsemsg2 = parsemsg:gsub("|r|h", "")
print(parsemsg2)
Code: Select all
SELL1 [ITEMNAME1] SELL2 [ITEMNAME2]
Code: Select all
3466e 3 141264 c998c9d4 c844ca38 c9c0c9fc 7f26a 7f242 7f454 7f206 45e5 a498
334ac 3 141264 c998c9d4 c844ca38 c9c0c9fc 7f26a 7f242 7f454 7f206 45e5 a498
Code: Select all
local str_hex1 = string.match(str, "|Hitem:.+.|h|c");
local str_hex2 = str_hex1:gsub("|Hitem:","")
local str_hex3 = str_hex2:gsub("|h|c", "")
print("HEX: "..str_hex3)
In that example effect is:
Code: Select all
3466e 3 141264 c998c9d4 c844ca38 c9c0c9fc 7f26a 7f242 7f454 7f206 45e5 a498ffa37d50[Dagger of Extremes]|r|h SELL2 334ac 3 141264 c998c9d4 c844ca38 c9c0c9fc 7f26a 7f242 7f454 7f206 45e5 a498
I spend a lot of hours for read LUA documentation about string modification and patterns, but i cant find good method.
So.. any idea how catch HEX values when i have more than 1 item?