2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by missil9
Featured Replies
  • 1

    [CODE]#include <boost/regex.hpp> #include <string> #include <boost/lexical_cast.hpp> using namespace std; double scrape( const std::string& base, const std::string& match ) { boost::regex re(match); boost::smatch matches; [COLOR="Green"]// while( boost::regex_search( start, base.end(), matches, re ) )[/COLOR] [COLOR="Red"]if( boost::regex_search( base, matches, re ) )[/COLOR] { std::string value( matches[1].first, matches[1].second ); return boost::lexical_cast<double>(value) ; } else … Read More

1
#include <boost/regex.hpp>
#include <string>
#include <boost/lexical_cast.hpp>

using namespace std;

double scrape( const std::string& base, const std::string& match )
{
    boost::regex re(match);
    boost::smatch matches;

    // while( boost::regex_search( start, base.end(), matches, re ) )
    if( boost::regex_search( base, matches, re ) )
    {
        std::string value( matches[1].first, matches[1].second );
        return boost::lexical_cast<double>(value) ;
    }
    else return 0.0 ;
}
Comments
well spotted
0

Thank you very much for the reply. It compiles fine now.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.