It seems that Boost.Locale cannot be used with std::regex. See the code below:
#include <regex> #include <boost/locale.hpp> int main() { try { boost::locale::generator gen; std::locale de_DE(gen("de_DE.UTF-8")); std::wstring in(L"Grün GRÜN grün"); std::wregex rx; rx.imbue(de_DE); rx.assign(L"grün", std::regex::icase); std::wcout << std::regex_replace(in, rx, L"green") << L"\n"; } catch (std::exception &e) { std::cout << "Exception: " << e.what() << "\n"; } } Outputs: green GRÜN green However this: #include <regex> #include <locale> int main() { try { std::locale de_DE("de_DE.UTF-8"); std::wstring in(L"Grün GRÜN grün"); std::wregex rx; rx.imbue(de_DE); rx.assign(L"grün", std::regex::icase); std::wcout << std::regex_replace(in, rx, L"green") << L"\n"; } catch (std::exception &e) { std::cout << "Exception: " << e.what() << "\n"; } } Correctly outputs: green green green Tested on Ubuntu 20.04.2. g++ 10.2, Boost.Locale built with ICU support using vcpkg (thus static link). _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users