Try, for instance
#include <iostream>
#include <regex>
using namespace std;
int main()
{
std::smatch sm;
string content ="[\nname: bin1\ntype: static\npx: 14\n]\n[\nname: car1\ntype: static\npx: 14\n]";
while (regex_search(content, sm, regex("\\[([^\\]]+)\\]")))
{
cout << sm[1] << endl;
content = sm.suffix();
}
}