const boost::u32regex regularExpression = boost::u32regex(boost::make_u32regex("^(.*)$")); const std::string format("Hallo\\1"); const std::string value("line\nline\nline\n"); std::cout << "before" << std::endl; std::cout << value << std::endl; std::cout << "after" << std::endl; std::cout << boost::u32regex_replace(value, regularExpression, format) << std::endl;