I am struggling with a regex in some code of mine.

I want to use regex_search to look for a match in a std::string, but my code will not build.

 

This is a snippet of what I am trying to do.

using namespace std;

 

string in_file_name_s;

string date_and_time_s;

string day_s;

char input_line[5000];

boost::regex re_date_time("(.*-.*-.*:.*:.*),.*,.*,.*,.*,.*,.*,.*,.*,");

boost::regex re_pices_date_time("(.*)\\-(.*)\\-(.*) (.*)");

boost::cmatch match;

 

while (inFile.getline(input_line , 5000))

{

  if (boost::regex_search(input_line, match , re_date_time ))

  {

    date_and_time_s = match[1];

       if (boost::regex_search(date_and_time_s , match , re_pices_date_time ))

         {

              day_s = match[1];

         }

  }

}

 

When I compile I get the following error

error C2784: 'bool boost::regex_search(const std::basic_string<charT,ST,SA> &,const boost::basic_regex<charT,traits> &,boost::regex_constants::match_flag_type)' : could not deduce template argument for 'const boost::basic_regex<charT,traits> &' from 'boost::cmatch'

The 1st regex_search looking at input_line char[] works Ok it’s the 2nd one looking at date_and_time_s std::string that gets the error.  If I remark out the 2nd one the program builds and I watch the input_line doing what it should in the debugger.

Also this code used to work before I upgraded from Visual C++6 to Visual C++8 and from bost_1_33_1 to boost_1_34_0.  I don’t know if it was the change in compiler or the boost lib that broke this.

Thanks in advance for your help.

Troy