1

I'm trying to capture the position of curly brackets using smatch:

smatch l, r, m;
auto closing = regex_search(ns, r, regex("\}"));

This code gives me runtime error:

libc++abi: terminating with uncaught exception of type std::__1::regex_error: The parser did not consume the entire regular expression.

And also I capture here:

regex_search(s, m, regex("\"menu\"\s*:\s*\{"))

This give me another one:

libc++abi: terminating with uncaught exception of type std::__1::regex_error: One of *?+{ was not preceded by a valid regular expression.

My text is like this:

"{  \"kvakushka\": {    \"popup\": {      \"menuitem\": [        \"mur\",        \"koshka\",        {          \"mur\": \"kva\",          \"vas\": \"gas\"        }      ]    }  },  \"menu\": {    \"id\": \"file\",    \"value\": \"File\",    \"popup\": {      \"menuitem\": [        \"file\", \"vasya\"      ]    },    \"menuitem\": [      {        \"value\": \"Font\"      },      {        \"value\": \"Size\"      }    ]  },  \"wisp\": {    \"popup\": {      \"menuitem\": [        \"mur\"        :        5,        \"var\"        :        10      ]    }  }}"

0 Answers0