c++ - C++11 regex::icase inconsistent behavior -


coming perl-like regular expressions, expected below code match regex'es in 8 cases. doesn't. missing?

#include <iostream> #include <regex> #include <string>  using namespace std;  void check(const string& s, regex re) {     cout << s << " : " << (regex_match(s, re) ? "match" : "nope") << endl; }  int main() {     regex re1 = regex("[a-f]+", regex::icase);     check("aaa", re1);     check("aaa", re1);     check("fff", re1);     check("fff", re1);     regex re2 = regex("[a-f]+", regex::icase);     check("aaa", re2);     check("aaa", re2);     check("fff", re2);     check("fff", re2); } 

running gcc 5.2:

$ g++ -std=c++11 test.cc -o test && ./test aaa : match aaa : match fff : nope fff : match aaa : match aaa : match fff : match fff : nope 


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -