mingw编译出C++正则表达式失效
·
- 代码
#include<string> #include<regex> #include <iostream> using namespace std; bool IsValidIP(const std::string& strIP) { std::string str="(((\\d{1,2})|(1\\d{1,2})|(2[0-4]\\d)|(25[0-5]))\\.){3}((\\d{1,2})|(1\\d{1,2})|(2[0-4]\\d)|(25[0-5]))(?=(\\b|\\D))"; cout<<"str="<<str<<endl; std::regex regExpress(str); return std::regex_match(strIP, regExpress); } int main() { bool bRet=IsValidIP("127.0.0.1"); cout<<"bRet="<<bRet<<endl; getchar(); return 0; } -
msvc编译:
-

-
msvc运行结果:

返回值为true
5. mingw编译:

6. mingw运行结果:
返回值为false。
总结mingw能编译c++正则表达式,但是mingw运行C++正则表达式不对。
更多推荐
所有评论(0)