Posted 24 November 2013 - 10:53 AM
Hey there,
i'm trying to extract two substrings of a given string with string.gmatch(). This is my current code:
But the output is just "123". The "blabla" part does not get printed.
If i try this:
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 :D/>
Best regards
Zacherl
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 :D/>
Best regards
Zacherl
Edited on 24 November 2013 - 11:04 AM