到达正则表达式部分时编译崩溃后的代码:
我想检查收到的字符串中是否存在任何数字或不存在.
#include <iostream>
#include <regex>
using namespace std;
int main()
{
int in, count, rate;
char *w;
cin >> count;
for(in = 1; in < 5; in++) {
rate = 0;
cin >> w;
cout << "Case #";
cout << in;
cout << ":";
if (regex_match (std::string(w), regex("([0-9])")))
++rate;
cout << rate;
cout << endl;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)