I can not seem to get the c++11 regex functions to work with even the most basic code. I must be missing something very basic, because this quick code keeps printing "No Match!" no matter what pattern I use.
std::string value = "foobar" ;
std::string pattern = "o" ;
std::regex re(pattern) ;
if (std::regex_search(value, re)) {
std::cout << "Matched!" << std::endl ;
} else {
std::cout << "No Match!" << std::endl ;
}
If it matters somehow, I compile (and get no errors) with
g++ -Wall -std=c++11 -o test test.cpp