1
我有以下一个简单的例子:其中<regex>
库用于在“hello world”中搜索“llo”。是否<regex>库工作正常?
#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版本4.7.1” 编译它使用以下命令:
c++ regex2.cpp -o regex2 -std=c++11
,其结果是:
false
Matched:
那么,什么是应该我做的错误?自编译以来,我可以假设c++11
能够在我的电脑上,因此库也能吗?
衷心的感谢!
不是。 。 。 。 –