Boost logo

Boost Users :

Subject: Re: [Boost-users] regex iterator question
From: Scott McMurray ([hidden])
Date: 2009-03-30 01:39:35

On Mon, Mar 30, 2009 at 02:25, Robert Ramey <ramey_at_[hidden]> wrote:
> I've got a need for regex and I would like to use it to extract tokens
> matching a regular expresssion from a file stream.  Seems like this would be
> a common desire.
> [snip]
> But, doesn't work.  multi_pass is a forward_trasversal iterator while
> regex_token_iterator requires a bidirectional_trasversal_iterator.  A huge
> disappoint to come soooo close.
> Thinking about it, this problem must come very often.  How is it usually
> addressed?  There must be a simple bridge across this.  In a pinch, I'll
> just have to load the whole file into some sort collection, but I prefer the
> ultimate unlimited file size solution.

It seems to me that since a bidi iterator can cover the whole range,
an adapter would have to end up just loading it all into memory

Have you considered rephrasing your regex as a PEG (which shouldn't be
hard) and using spirit instead? That way the multi-pass would be
sufficient. I seem to recall a mention of a Spirit.Lex that might be
exactly what you need...

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at