How can I remove text inside brackets in Lua?

gsub, lua, regex

Solution

Try this:

str = str:gsub('%b()', '')

Problem

I have a text like `"Text the I need (extra descriptor) text"` and I want `"Text the I need text"`. I have tried to use `str:gsub('\([^)]*\)', "")` but for some reason fails to work

Original source