c++ - regex("(abc|aa.*|bb.*)") Vs regex("(aa.*|bb.*|cc.*)"); -
this question has answer here:
i encounter weird problem when using regex in c++11 (ubuntu 14.4 ,gcc 4.8.2)
#include <iostream> #include <regex> using namespace std; int main() { regex r("(abc|aa.*|bb.*)"); cout<<regex_match("bb11",r)<<endl; //return false cout<<regex_match("aa11",r)<<endl; //return true cout<<regex_match("abc",r)<<endl; //return true return 0; }
while
int main() { regex r("(aa.*|bb.*|cc.*)"); cout<<regex_match("bb11",r)<<endl; //return true cout<<regex_match("aa11",r)<<endl; //return true cout<<regex_match("abc",r)<<endl; //return false return 0; }
i wondering why "bb11" got different result?
std::regex
not supported in gcc until 4.9.
in 4.8.2 you'll sorts of odd behaviour.
Comments
Post a Comment