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

#include <boost/tr1/regex.hpp>

#include <iomanip>
#include <iostream>
#include <string>

int main(){

  std::cout << std::endl;

  int len= 17;

  // 01.02.2003
  std::string german{"01/02/03"};
  std::cout << std::setw(len) << std::left << "Germany: " << german << std::endl;

  // extract the date parts
  std::tr1::regex rgxDate(R"(([0-9]{1,2})/([0-9]{1,2})/([0-9]{1,2}))");

  std::cout << std::setw(len) << std::left << "North America: " << std::tr1::regex_replace(german,rgxDate,"$2/$1/$3") << std::endl;
  std::cout << std::setw(len) << std::left << "South America: " << std::tr1::regex_replace(german,rgxDate,"$1/$2/$3") << std::endl;
  std::cout << std::setw(len) << std::left << "China: " << std::tr1::regex_replace(german,rgxDate,"$3/$2/$1") << std::endl;
  std::cout << std::setw(len) << std::left << "Russia: " << std::tr1::regex_replace(german,rgxDate,"$1/$2/$3") << std::endl;


  std::cout << std::endl;

}


