https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103664
Bug ID: 103664 Summary: std::regex_replace bug if the string contains \0 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: artur77 at freemail dot hu Target Milestone: --- I think I found a bug in std::regex_replace. The following code should write "1a b2" with length 5, but it writes "1a2" with length 3. #include <iostream> #include <regex> using namespace std; int main() { string a = regex_replace("1<sn>2", std::regex("<sn>"), string("a\0b", 3)); cout << "a: " << a << "\n"; cout << a.length(); return 0; }