str = "{foo {baz}{bar}"first, second = str:match('{([^}]*)}%s*{([^}]*)}')print (first, "---", second)
Standard input is empty
foo {baz --- bar
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!