0

I have weird result on recent Code::Blocks 13.12 (it includes MinGW-ported g++ 4.7, as I see). Consider basic example: I want to match "abc" substring in "abc" string.

#include <iostream>
#include <string>
#include <regex>

using namespace std;

int main() {
    string t("abc");
    regex r(t);
    smatch res;
    string s("abc");

    regex_search(s, res, r);
    for (auto x: res)
        std::cout << x << endl;
}

This yields "abs" on stdout under GCC 4.9 on my linux laptop, but under C::B at Windows I get empty string. How this can be?

Artem Pelenitsyn
  • 2,508
  • 22
  • 38

0 Answers0