Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-08-03 06:30:28


Tommy Li wrote:
> I've tried matching like this:
>
> std::string input = filecontents;
> boost::regex re_paragraphs("\\n\\n");
>
> boost::sregex_token_iterator input_token_it(input.begin(),
> input.end(), re_paragraphs, -1);
> boost::sregex_token_iterator end_token_it;
>
> for( ; input_token_it != end_token_it; input_token_it++ )
> {
> output += "TOKEN FOUND"
> }
> return output;
>
> But this never works. It matches when I use a part of a word as a
> token. The problem is that it's just not matching the newlines. I've
> looked
> into the input's hex and there are indeed two newline chars
> consecutively.
>
> I think I'm missing something obvious. Anyone have any idea?

That certainly should work, let me have a test case if you're really
convinced that it doesn't.

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