I'm trying to do something like in the example of boost::regex_serach in here .
My sample of code is :
boost::regex expression("<name=\"[a-zA-z0-9]+\" "
"init=\"[0-9]+\"/>");
std::string::const_iterator start, end;
start = Field.begin();
end = Field.end();
boost::smatch what;
boost::match_flag_type flags = boost::match_default;
while(regex_search(start, end, what, expression,flags)){
std::cout<<"@@@" << std::string(what[0].first,what[0].second);
start = what[0].second;
// update flags:
flags |= boost::match_prev_avail;
flags |= boost::match_not_bob;
}
I have some xml file ..... name="SamleName" init="6"/...
And want to have SamlpeName in what[1]
and init value in what[2]
, but code listed here only write this field" name="SamleName" init="6"/"
to what[0]
.
How can I split this like in regex_search example ??