Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2006-07-24 18:29:40


Torsten Landschoff wrote:
>
> boost::smatch sm;
> BOOST_REGEX_TEST(boost::regex_match(std::string(text), sm, re));

Here is your problem. You're performing a match on a temporary
std::string. After regex_match returns, sm will be left holding
iterators into a destroyed string. Try:

   std::string str(text);
   BOOST_REGEX_TEST(boost::regex_match(str, sm, re));

instead.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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