I have a regex as:
std::regex regexp(
R"(\$\ part,\ model.*[\n\r]([-]?[0-9]*\.?[0-9]+[Ee]?[-+]?[0-9]*),([-]?[0-9]*\.?[0-9]+[Ee]?[-+]?[0-9]*))",std::regex::extended);
The code compiles, but I receive the following error:
Unhandled exception at 0x748F49C2 in regex.exe: Microsoft C++ exception: std::regex_error at memory location 0x00EFEE30.
std::regex::extended, use the default ECMAScript flavor.regex_error(error_escape): The expression contained an invalid escaped character, or a trailing escape.externdedsyntax only allows certain special characters to be escaped by a backslash, not any arbitrary character. In particular, space is not a special character, and\is invalid in extended syntax. So are\nand\rit seems; those characters should be represented by themselves (which would be tricky in a raw string literal). All told, you probably don't wantextended; you are probably looking formultilineoption.