0
#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.

SergeantPenguin
  • 843
  • 7
  • 16
  • It could be. The newest version displays `Nothing Found`: http://coliru.stacked-crooked.com/a/a3a4986f6fa825d7 – NathanOliver Dec 08 '15 at 21:06
  • From [here](http://stackoverflow.com/questions/12530406/is-gcc-4-8-or-earlier-buggy-about-regular-expressions) regex wasn't implemented until 4.9.0 so there still might have been some bugs in by 4.9.2 – NathanOliver Dec 08 '15 at 21:11

0 Answers0