I have a string which I want to replace the specific characters and symbols with nothing: print(“hg[x]llo world”). Replace the g[x] with nothing so it becomes print(“hello world”)
What solutions have I tried so far?
local str = [[
print("hg[x]llo world")
]]
local removeStringValue = string.gsub(str, ("g[x]"), "")
and also looking on google for some results. I do know about string patterns but since I only want to remove the “g[x]” part, removing the square brackets wont help if I have a different string such as running through i. e.g:
names[i] -- will remove the [] becoming "namesi" which I dont want
str = print("hg[x]llo world")
local removeStringValue = string.gsub(str, ("g[x]"), "") -- to make it print("hello world"). I just want to remove the "g[x]" (string).