The idea of application is to convert backslashes into forwardslashes. Running following code:
int main() {
std::string x = "\\";
std::string s = "C:\\tony\\hawk\\";
std::cout << std::regex_replace(s,std::regex(x),"/") << std::endl;
//std::cout << boost::regex_replace(s,boost::regex("\\\\"),"\\") << std::endl;
std::cout << s << std::endl;
}
results in throwing this error message:
terminate called after throwing an instance of 'std::regex_error'
what(): Unexpected end of regex when escaping.
fish: Job 1, './a.out' terminated by signal SIGABRT (Abort)
I cannot understand what is wrong with the "\\" regex. Shouldn't it match all of the backslashes?