C++ TR1 regex - multiline option
I thought that $ indicates the end of string. However, the following
piece of code gives "testbbbccc" as a result, which is quite astonishing
to me... This means that $ actually matches end of line, not end of the
whole string.
#include <iostream>
#include <regex>
using namespace std;
int main()
{
tr1::regex r("aaa([^]*?)(ogr|$)");
string test("bbbaaatestbbbccc\nddd");
vector<int> captures;
captures.push_back(1);
const std::tr1::sregex_token_iterator end;
for (std::tr1::sregex_token_iterator iter(test.begin(), test.end(),
r, captures); iter != end; )
{
string& t1 = iter->str();
iter++;
cout << t1;
}
}
I have been trying to find a "multiline" switch (which actually can be
easily found in PCRE), but without success... Can someone point me to
the right direction?
Regards, R.P.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]