Ответ 1
Не используйте regex_match, используйте regex_search. Здесь вы можете найти примеры: http://www.codeguru.com/cpp/cpp/cpp_mfc/stl/article.php/c15339.
Это должно сделать трюк (заметьте, что я печатаю непосредственно в браузере, не компилировал его):
#include <iostream>
#include <regex>
int main()
{
// regular expression
const std::regex pattern("hello ([0-9]+)");
// the source text
std::string text = "hello 1, hello 2, hello 17, and done!";
const std::sregex_token_iterator end;
for (std::sregex_token_iterator i(text.cbegin(), text.cend(), pattern);
i != end;
++i)
{
std::cout << *i << std::endl;
}
return 0;
}