I need some help with creating my pattern. I've got the basic parts done, but one issue remains.
Let's say I have a string as follows:
John: I can type in :red:colour! :white:Not in the same :red:wo:green:rd :white:though :(
I have this code setup to separate the colors from the actual value:
line = "John: I can type in :red:colour! :white:Not in the same :red:wo:green:rd :white:though :("
for token in string.gmatch(line, "%s?[(%S)]+[^.]?") do
for startpos, token2, endpos in string.gmatch(token, "()(%b::)()") do
print(token2)
token = string.gsub(token, token2, "")
end
print(token)
end
Will output:
John:
I
can
type
in
:red:
colour!
:white:
Not
in
the
same
:red:
:green:
word
:white:
though
:(
When I want it to print out:
John:
I
can
type
in
:red:
colour!
:white:
Not
in
the
same
:red:
wo
:green:
rd
:white:
though
:(
Any help would be greatly appreciated.