string sg = "<body><D>cocoa</D><D>yyyt</D><D>ckkk</D></body>";
boost::regex reg("<body>??????????</body>");
我要提取<D></D>之间的串,一次吧三个串都提取出来,这个reg怎么设置呀??
解决了:
string sg = "<body><D>cocoa</D><D>yyyt</D><D>ckkk</D></body>";
boost::regex reg("<body>??????????</body>");
我要提取<D></D>之间的串,一次吧三个串都提取出来,这个reg怎么设置呀??
string::const_iterator it = sg.begin();
string::const_iterator end = sg.end();
boost::smatch what;
while(boost::regex_search(it,end,what,reg))
{
string doc = what[1];
cout<<doc<<endl;
it = what[0].second;
}