regex_replace flag to ignore multiline?

Hi @Marcus-0865,

If you want visual studio to get the same result as the demo, you need to use match_continuous, which specifies that the expression must match a sub-sequence that begins at first.

Sample Code:

 std::regex re("^red+\n");
 std::string str = std::regex_replace(text, re, "",std::regex_constants::match_continuous);



Best regards,


If the answer is the right solution, please click “Accept Answer” and upvote it.If you have extra questions about this answer, please click “Comment“.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Read more here: Source link