Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::regex_search upgrade from 1_36 to 1_45
From: John Maddock (boost.regex_at_[hidden])
Date: 2010-12-15 05:28:27


> I have upgraded my boost to 1_45 (it was 1_36) and since then I have an
> error on boost::regex_search

What error? Compiler?

> here is the code
>
> std::string regexp = "\\^:\\([^;^]*\\);\\([^;^]*\\);\\([^^]*\\)\\^:";
> boost::regex expression(
> regexp.c_str()
> , boost::regex::basic|boost::regex::icase
> );
>
> std::string::const_iterator it_prev = str.begin();
> std::string::const_iterator it_end = str.end();
> std::string tmp;
> while (boost::regex_search(it_prev, what, expression))

OK, *if* std::string iterator happens to be a const char* then this will
work, otherwise it won't, suggest you use:

boost::smatch what;
while (boost::regex_search(str, what, expression))
{ //etc

My guess is you upgraded compiler at the same time as updating Boost?
Basically your old code compiled "by accident"...

HTH, 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