C++中的正则表达式(正则表达式)错误:"在抛出'std :: regex_error'的实例后调用终止what():regex_error中止(核心转储)

mus*_*vuz 0 c++ regex c++11

可能重复:
关于正则表达式的gcc4.7错误吗?

我用"g ++ test.cpp -std = gnu ++ 0x"编译下面的代码.编译是成功的,但是当我运行./a.out时,它会给出错误,就像我不明白它为什么会发生一样.我的操作系统是Mint.

错误:"在抛出'std :: regex_error'的实例后调用终止what():regex_error Aborted(core dumped)"

Code:
// regex_match example
#include <iostream>
#include <string>
#include <regex>

using namespace std;

int main ()
{
  string s ("this subject has a submarine as a subsequence");
  regex e("sub[a-z]");   // matches words beginning by "sub"
  smatch m;

  return 0;
}
Run Code Online (Sandbox Code Playgroud)

Pet*_*ker 7

代码看起来很好.GCC的正则表达式实现无法使用.不要浪费你的时间.