#include #include #include std::string unescapeUnicode(const std::string& input) { // Regular expression pattern to match Unicode escape sequences std::regex pattern("\\\\u([0-9A-Fa-f]{4})"); // Function to replace each Unicode escape sequence with its corresponding character auto replaceUnicode = [&](const std::smatch& match) -> std::string { int codepoint = std::stoi(match[1].str(), nullptr, 16); return std::string(1, static_cast(codepoint)); }; // Use std::regex_replace to replace all occurrences of Unicode escape sequences return std::regex_replace(input, pattern, replaceUnicode); }