15 std::string pattern =
"(^|[^a-zA-Z0-9_])\\[(.*?)\\]";
16 std::regex regular_expression(pattern);
19 while (std::regex_search(text, match, regular_expression)) {
26 if ( match[2].str().contains(
"[") ) {
27 throw std::runtime_error(
"Nested collections are not supported");
29 std::string collection =
"[" + match[2].str() +
"]";
34 size_t startPos = (size_t)match.position(2)-1;
35 size_t length = (size_t)match.length(2)+2;
36 text.replace(startPos, length, std::to_string(
id));