I have the following code:
#include <string>
#include <regex>
#include <iostream>
int main()
{
std::string s;
s += '\x06';
s += '\x00';
std::regex r(std::string(1, '\x06') + '\x00');
std::smatch sm;
if (std::regex_search(s, sm, r))
{
std::cout << "Success\n";
return 0;
}
std::cout << "Failure\n";
}
On Windows, I get "Success" while on Linux, I get "Failure". I use MSVC 19.28 on Windows and GNU 9.3.0 on Linux. Why is the output different?