I have problem with boost::regex, this solution works only for one result in each match
boost::regex regex("id=\"(.*?)\""); // should I use this "id=\"(.*?)\"(.*?)<value>(.*?)</value>"?
boost::sregex_token_iterator iter(xml.begin(), xml.end(), regex, 1); // 1 because I just need text inside quotes
boost::sregex_token_iterator end;
and now parsed string
<x id="first">
<value>5</value>
</x>
<x id="second">
<value>56</value>
</x>
etc...
Now question is how to parse id and value at once to grab them both inside matches loop
for( ; iter != end; ++iter ) {
std::string id(iter->first, iter->second);
std::string value(?????);
}