code: function parse_balanced(re_open, re_close, re_rest) {
    result = match(re_rest);
    while (look(re_open)) {
      result += match(re_open);
      result += parse_balanced(re_open, re_close, re_rest);
      result += match(re_close);
      result += match(re_rest);
    }
    return result;
  }
docs: Helper method to parse a string up to a closing brace, balancing opening-closing braces in between.  @param re_open  The beginning brace regex @param re_close The closing brace regex @param re_rest  Regex to match text without any braces