Hey all,
I'm using tr1::regex to try to extract some matches from a string. An example string could be
asdf werq "one two three" asdf
And I would want to get out of that:
asdf
werq
one two three
asdf
With stuff in quotes grouped together, so I'm trying to use the regex \"(.+?)\"|([^\\s]+)
. The code I'm using is:
cmatch res;
regex reg("\"(.+?)\"|([^\\s]+)", regex_constants::icase);
regex_search("asdf werq \"one two three\" asdf", res, reg);
cout << res.size() << endl;
for (unsigned int i = 0; i < res.size(); ++k) {
cout << res[i] << endl;
}
but that outputs
3
asdf
asdf
What am I doing wrong?