c++ - Unable to match locale dependent characters -


i need match word, including french ones ( accents é,è,ê etc). have set locale french_france.1252 , used flag std::regex_constants::collate accented letters still don't give match :

#include <iostream> #include <string> #include <regex> #include <locale>   void display_result(const std::string & _str, const std::regex & _rgx) {     if (std::regex_match(_str, _rgx))         std::cout << "positive match found in \"" << _str << "\".\n";     else         std::cout << "no match found in \"" << _str << "\".\n"; }  int main(int argc, char *argv[]) {     setlocale(lc_all, "");     std::locale::global(std::locale(""));       std::regex rgx("[[:alpha:]]+", std::regex_constants::icase | std::regex_constants::extended | std::regex_constants::collate);      std::cout << "regex use " << rgx.getloc().name() << " locale.\n";       std::string str{ "student" };      display_result(str, rgx);      str = "Élève";      display_result(str, rgx);      rgx.assign("[[=e=]]", std::regex_constants::icase | std::regex_constants::extended | std::regex_constants::collate);     str = "e";      display_result(str, rgx);      str = "É";      display_result(str, rgx);       std::cin.get(); } 

output :

    regex use french_france.1252 locale.     positive match found in "student".     no match found in "Élève".     positive match found in "e".     no match found in "É". 

i cannot use wide char ( string program must parse come char * argv[] ) nor can use boost. idea on went wrong ? use microsoft visual studio 2013.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -