Boost logo

Boost :

Subject: Re: [boost] [algorithm][string] regex_finder examples
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-10-17 13:04:10


AMDG

Robert Dailey wrote:
> I noticed that there are no examples for using regex_finder with
> find_iterator. I checked the test & example directories in libs, and also
> the documentation. I found nothing useful. Could someone provide a quick
> example? So far here is what I have, but it does not compile:
>

It compiles for me with the trunk, but crashes at runtime.

>
> boost::find_iterator<std::string::iterator> keyIt( queryKey,
> boost::regex_finder( boost::regex( "/.*?" ) ) );

Don't pass a temporary regex to regex_finder. The find_iterator ends up
holding a reference to a destroyed regex.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk