#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main(){
string pattern("[^c]ei");
pattern = "[[:alpha:]]*" + pattern + "[[:alpha:]]*";
regex r(pattern);
smatch results;
string test_str = "receive";
if (regex_search(test_str, results, r))
cout << results.str() << endl;
else cout << "Nothing found" << endl;
}
Using GCC 4.9.2 I am expecting an output of Nothing found
for this program except from program outputs ceive
. Given the syntax I cannot understand why, have I misunderstood regex syntax or is this a bug with GCC 4.9.2? I was under the impression that by 4.9.2 regex
support was pretty good.