I am trying to match lines from on an input file using regex, and I have started with this test case to match for the types of lines that I want.
#include <iostream>
#include <regex>
int main(int argc, char *argv[]) {
std::string s("%%%% Data and file %%%%");
std::regex expr("%%%% (.*) %%%%", std::regex_constants::basic);
bool match = regex_match(s, expr);
std::cout<<match;
}
I expect the supplied regular expression to match the search string, as I have tested this expression on two separate regex testers. Why is C++ not matching this? Furthermore I have tried other expressions too that should match the search string, none of them work. I am beginning to think I am overlooking some subtlety in C++ regex implementation.