Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-08-03 12:14:07


Tommy Li wrote:
>> I think I'm missing something obvious. Anyone have any idea?
>
> By the way, I can't even match one newline char with "\\n" though they
> are obviously there.

Well here's a sample program that obviously shows it does work :-)

#include <boost/regex.hpp>
#include <iostream>

int main(int,char**)
{
  boost::regex e("\\n");
  std::string s("one\ntwo\nthree");
  boost::sregex_token_iterator i(s.begin(), s.end(), e, -1), j;
  while(i != j)
  {
    std::cout << "<" << *i << ">" << std::endl;
    ++i;
  }
}

which outputs:

<one>
<two>
<three>

Just as expected.

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net