<分区>
我有以下简单示例:其中 <regex>
库用于在“hello world”中搜索“llo”。
#include <regex>
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
cout << boolalpha;
regex rgx("llo");
cmatch result;
cout << regex_search("hello world", result, rgx) << endl;
cout << "Matched: " << result.str() << endl;
return 0;
}
我用“gcc version 4.7.1”编译它,命令如下:
c++ regex2.cpp -o regex2 -std=c++11
结果是:
false
Matched:
那么,我应该做错什么?由于它编译,我可以假设 c++11
可以在我的电脑上使用,因此图书馆也可以吗?
衷心感谢!