See the code below:
const std::string line = "myemail@gmail.com";
const std::string egrep = ".*gmail.*";
std::regex txt_regex(egrep.c_str());
if (!std::regex_match(line, txt_regex)) {
std::cout << "Not matched?!" << std::endl;
}
else {
std::cout << "Matched" << std::endl;
}
It will print out Matched. However, if I end that line with CR or LF (\r or \n respectively) it will print Not matched?!
Is that a bug or expected reaction on CR with default regex flags?