For my c++ class, we have been given a "simple regular expression assignment". But every time I try to use regex_search() in Visual Studio Community 2015, I get "no instance of overloaded function "regex_search" matches the argument list". I mouse-over the error, and it tells me it wants (for one example) string, smatch, string; which is exactly what I give it.
Here is my code:
include <iostream>
include <string>
include <regex>
using namespace std;
int main( int argc, char *argv[] )
{
string regexCriteria1 = "\\.$";
string test = "asdf.";
smatch searchResult;
for each ( string line in quotes ) // I have also tried const auto &line in quotes
{
cout << regex_search( line, regexCriteria1 ) << endl;
regex_search( line, searchResult, regexCriteria1 );
regex_search( line.begin(), line.end(), searchResult, regexCriteria1 );
}
regex_search( test, searchResult, regexCriteria1 );
}
I have no idea why none of these regex_search() lines are working. This was supposed to be a 45 minute project, it has already taken me over 2 hours, and I am nowhere near done. This would have only taken me 5 minute in Java. Any help would be greatly appreciated. My wife is starting to fear for my sanity.