tags:

views:

329

answers:

1

I've not been able to get regex_replace from TR1 working.

#include <iostream>
#include <string>
#include <tr1/regex>

int main()
{
std::string str = "Hello world";
std::tr1::regex rx("world");
std::string replacement = "planet";
std::string str2 = std::tr1::regex_replace(str, rx, replacement);

std::cout << str2 << "\n";
}

str2 is an empty string.