I'm writing a application to parse some commands. Commands are given in the form:
A { B }
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?
For example, given:
"parsme { foo { "hello" } { "goodbye" } {{{ } { bar { "up" } { "down" } }"
Then:
A = "parseme { foo { "hello" } { "goodbye" } {{{ }" and B = "bar { "up" } { "down" }"