0

I have a string, which has the word "amogus" in it. I use gsub, to replace amogus with

"<font color="..red..">".."amogus".."</font>"

But everytime I refresh to check for anything else I need to gsub, it thinks that the replaced text needs to be replaced, since it also contains amogus. How can I fix this? Thanks -creepersaur

Egor Skriptunoff
  • 23,359
  • 2
  • 34
  • 64

1 Answers1

2

You may solve it with %f pattern:

local s = "  amo  <>amo<>  "
s = s:gsub("%f[%w>]amo", "<>amo<>")
print(s)  -->   <>amo<>  <>amo<>  
Egor Skriptunoff
  • 23,359
  • 2
  • 34
  • 64