【发布时间】:2021-07-31 15:37:33
【问题描述】:
https://stackoverflow.com/a/33307828/9250490
你可以通过regex_search(s.cbegin(), s.cend()...找到第一个5序号12345
string s = "abcde, eee12345 11111ddd 55555 hello";
std::smatch m;
bool b = std::regex_search(s.cbegin(), s.cend(), m, std::regex("[0-9]{5}"));
cout << m[0] << endl;
但是如果我想找到最后一个55555,我试过了,
std::regex_search(s.crbegin(), s.crend(), m, std::regex("[0-9]{5}"));
但是编译不会出错,
Error C2672 'std::regex_search': no matching overloaded function found ForTest
基于 C++17 标准的 Visual Studion 2019。 为什么?
【问题讨论】:
标签: c++ regex string iterator c++17