1

I'm trying C++ regex first time, and I use example minimized from cplusplus.com, but I have runtime error always..

CODE:

#include <iostream>
#include <regex>

int main () {

    std::string s = "there is a subsequence in the string\n";
    std::string e = "$1 and $2";
    std::cout << regex_replace(s, std::regex("\\b(sub)([^ ]*)"), e);

    return 0;
}

COMPILE:

mingw32-g++.exe -std=c++11 -c C:\Users\Daniel\Desktop\test.cpp -o C:\Users\Daniel\Desktop\test.o
mingw32-g++.exe -o C:\Users\Daniel\Desktop\test.exe C:\Users\Daniel\Desktop\test.o 

ERROR:

Runtime Error

Answer: Is gcc 4.8 or earlier buggy about regular expressions? @R. Martinho Fernandes

Community
  • 1
  • 1
Iburidu
  • 450
  • 2
  • 5
  • 15

0 Answers0