I am trying to use std::regex in a C++11 piece of code, but it appears that the support is a bit buggy. An example:
#include
#include
At this moment (using std=c++14 in g++ (GCC) 4.9.2) is still not accepting regex_match.
Here is an approach that works like regex_match but using sregex_token_iterator instead. And it works with g++.
string line="1a2b3c";
std::regex re("(\\d)");
std::vector inVector{
std::sregex_token_iterator(line.begin(), line.end(), re, 1), {}
};
//prints all matches
for(int i=0; i
it will print 1 2 3
you may read the sregex_token_iterator reference in: http://en.cppreference.com/w/cpp/regex/regex_token_iterator