fork download
  1. local str = "Extract (a(b)c) and ((d)f(g))";
  2. for s in string.gmatch(str, "%b()") do print(s) end
  3. local str2 = "Extract [a[b]c] and [[d]f[g]]";
  4. for s in string.gmatch(str2, "%b[]") do print(s) end
  5. local str3 = "Extract {a{b}c} and {{d}f{g}}";
  6. for s in string.gmatch(str2, "%b{}") do print(s) end
Success #stdin #stdout 0s 14112KB
stdin
Standard input is empty
stdout
(a(b)c)
((d)f(g))
[a[b]c]
[[d]f[g]]