function test_balanced_scan( s ) print( '----> ', s ) for w in string.gfind(s, "%b{}") do print(w) end end test_balanced_scan( "Hallo {schöne und wunderbare} Welt" ) test_balanced_scan( "Hallo {schöne {und} wunderbare} Welt" )