No matches with c++11 regex

c++, c++11, regex

Solution

Because `<regex>` is not yet implemented in libstdc++, as documented here (§28).

For now, use Boost.Xpressive or Boost.Regex instead.

Problem

Why does this find no matches in g++ (Debian 4.6.3-1) 4.6.3 or clang version 3.2 (trunk 159457) ``` #include <iostream> #include <string> #include <regex> using namespace std; int main() { string line("test"); regex pattern("test",regex_constants::grep); smatch result; bool ret(false); ret = regex_search(line,result,pattern); cout << boolalpha << ret << endl; cout << result.size() << endl; return 0 ; } ``` output ``` false 0 ```

Original source

Related problems