Help me to split these kind of string :
Example:
string to split : "{'day': 1, 'count': 100}, {'day': 2, 'count': 100}"
expected output : [ {'day': 1, 'count': 100}, {'day': 2, 'count': 100} ]
using namespace std;;
#include<string>
#include<regex>
#include<iostream>
int main()
{
string s1("{asd, dsf},{fsdfsdf, sdff}");
regex e("/{([^}]*)}/");
cout << s1 << std::endl;
sregex_iterator iter(s1.begin(), s1.end(), e);
sregex_iterator end;
while(iter != end)
{
cout << (*iter)[i] << std::endl'
++iter;
}
}
this code fails for regex mentioned in the https://stackoverflow.com/a/413077/11017988