How can I remove special characters in strings?

local String = "[HELLO]"

How can I remove the “[]”? I know it’s possible using string.gsub, but I don’t know how.
Thanks for help!

str = str:gsub('[%p%c%s]', '')

Source: How do I remove all special characters, punctuation and whitespaces from a string in Lua? - Stack Overflow

Escape any magic character by using the percentage sign (%) before it:

local String = "[HELLO]"
print( String:gsub("[%[%]]", "") )