title: Parsing a string with nested brackets
body: <p>I'm writing a application to parse some commands. Commands are given in the form:</p>
  
  <p>A { B }</p>
  
  <p>I just want A and B. A is optional but that's easy enough to handle. The problem I'm having is that both A and B can contain almost any character including whitespace and '{' and '}'. The brackets need not be balanced, either. Is this possible to parse with a regex? If not, what is the simplest thing that you think could be done?</p>
  
  <p>For example, given:</p>
  
  <p>"parsme { foo { "hello" } { "goodbye" } {{{ } { bar { "up" } { "down" } }"</p>
  
  <p>Then:</p>
  
  <p>A = "parseme { foo { "hello" } { "goodbye" } {{{ }" and B = "bar { "up" } { "down" }"</p>