str = "fa, (captured)[asd] asf, 31"
for word in str:gmatch("\(%a+\)") do
print(word)
end
你好!我想要捕获括号中的单词。
我的代码应该输出“captured”字符串。
lua: /home/casey/Desktop/test.lua:3: invalid escape sequence near '\('
我遇到了语法错误。
当然,我可以找到括号的位置并使用string.sub函数。
但我更喜欢简单的代码。
另外,括号也给我带来了类似的错误。