std regex_search to match only current line
问题 I use a various regexes to parse a C source file, line by line. First i read all the content of file in a string: ifstream file_stream("commented.cpp",ifstream::binary); std::string txt((std::istreambuf_iterator<char>(file_stream)), std::istreambuf_iterator<char>()); Then i use a set of regex, which should be applied continusly until the match found, here i will give only one for example: vector<regex> rules = { regex("^//[^\n]*$") }; char * search =(char*)txt.c_str(); int position = 0,