Мой код:
#include <boost/regex.hpp>
boost::cmatch matches;
boost::regex_match("alpha beta", matches, boost::regex("([a-z])+"));
cout << "found: " << matches.size() << endl;
И это показывает found: 2
который означает, что ТОЛЬКО ОДНО возникновение найдено …, Как дать этому команду находить ТРИ случаев?Спасибо!
Вот что я пока нашел:
text = "alpha beta";
string::const_iterator begin = text.begin();
string::const_iterator end = text.end();
boost::match_results<string::const_iterator> what;
while (regex_search(begin, end, what, boost::regex("([a-z]+)"))) {
cout << string(what[1].first, what[2].second-1);
begin = what[0].second;
}
И все работает, как ожидалось. Может кто знает решение получше?