How would I use gsub to replace characters between <
and >
(including the <>)?
I tried using:
string.gsub(Text, "<[^>]+>", "")
which i got from stack overflow (i thought the string pattern would be the same)
How would I use gsub to replace characters between <
and >
(including the <>)?
I tried using:
string.gsub(Text, "<[^>]+>", "")
which i got from stack overflow (i thought the string pattern would be the same)
The string pattern seems to work for me
local TestString = "Hello Hi <Hello!> hi"
TestString = string.gsub(TestString, "<[^>]+>", "hi")
print(TestString) -->> Hello Hi hi hi
Hmm, im using it to turn a string like:
"<font color='rgb(1,0,0.7881507873535156)'>font color="rgb(220, 255, 0)">L/font>font color="rgb(65, 255, 0)">e/font>font color="rgb(0, 255, 89)">g/font>font color="rgb(0, 255, 244)">e/font>font color="rgb(0, 110, 255)">n/font>font color="rgb(44, 0, 255)">d/font></font>"
into
Legend
Which doesnt work.
When i run it and output the result, i get:
'font color="rgb(220, 255, 0)">L/font>font color="rgb(65, 255, 0)">e/font>font color="rgb(0, 255, 89)">g/font>font color="rgb(0, 255, 244)">e/font>font color="rgb(0, 110, 255)">n/font>font color="rgb(44, 0, 255)">d/font>'
I think its something to do with there being multiple <>
s