I have the following easy example: where <regex>
library is used to search "llo" in "hello world".
#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;
}
I compile it with "gcc version 4.7.1" with the following command:
c++ regex2.cpp -o regex2 -std=c++11
And the result is:
false
Matched:
So, what is supposed I am doing wrong? Since it compiles, can I assume that c++11
is able on my computer and therefore library is able too?
Sincerely thanks!