// replace #include <boost/tr1/regex.hpp> with
//         #include <regex>
// and
// std::tr1:: with std:: in the source code

#include <boost/tr1/regex.hpp>

#include <iostream>
#include <iterator>
#include <string>

int main(){

  std::cout << std::endl;
  
  std::string log="66.249.64.13 - - [18/Sep/2012:11:07:48 +1000] GET /robots.txt HTTP/1.0 200 468 - Googlebot/2.1\n"
                  "66.249.64.13 - - [18/Sep/2012:11:07:48 +1000] GET / HTTP/1.0 200 6433 - Googlebot/2.1";

  std::cout << log << "\n\n";

  // anonymize IPs
  std::tr1::regex rgxIPs(R"(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.[0-9]{1,3})");


  std::string allIPs;
  std::tr1::regex_replace(std::back_inserter(allIPs), log.begin(), log.end(),rgxIPs,"$1.XXX\n",std::tr1::regex_constants::format_no_copy);

  std::cout << allIPs << std::endl;

}
