i'm trying to extract two substrings of a given string with string.gmatch(). This is my current code:
local s = "::hook::123:blabla" local d = string.gmatch(s, "::hook::(/>%d+):(/>.+)") for k in d do print(k) end
But the output is just "123". The "blabla" part does not get printed.
If i try this:
local s = "::hook::123:blabla" local d = string.gmatch(s, "::hook::(/>%d+):(/>.+)") for k, v in d do print(k .. ":" .. v) end
the output is "123:blabla", but it's grouped into key value pairs, what does not look right to me.
Is there a way to extend the first code for the second pattern to be included?
Edit: The "/>" is not part of my regex. Seems to be an error with this vBulletin code plugin
Best regards
Zacherl
Edited by Zacherl1990, 24 November 2013 - 12:04 PM.












