4
std::cmatch res;
std::string str = "<h2>I'm a piece of text</h2>";
std::regex rx("<h(.)>([^<]+)");
std::regex_search(str.c_str(), res, rx);
std::cout << res[1] << ". " << res[2] << "\n";
這段簡單的代碼應該工作嗎?對? 顯然,這不:regex_search throwing std :: regex_error
terminate called after throwing an instance of 'std::regex_error'
what(): regex_error
Aborted
編譯器(GCC 4.7.0)的bug還是我失去了一些東西?
它一直未動AFAICT: http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2011 – rubenvb