我的代碼:boost :: regex_replace()只替換第一次出現,爲什麼?
#include <string>
#include <boost/algorithm/string/regex.hpp>
std::cout << boost::algorithm::replace_regex_copy(
"{x}{y}", // source string
boost::regex("\\{.*?\\}"), // what to find
std::string("{...}") // what to replace to
);
這是我所看到的:
{…}{y}
因此,只有第一次出現取代。爲什麼?如何解決它?
非常感謝!:) – yegor256 2010-05-17 10:28:05