perl -ne 'print "good string\n" if $_~~ /^({(?:[^{}]++|(?1))*+})/;'