31 Mar
2012
31 Mar
'12
9:05 a.m.
Hi,
I have a string with 2 Cyrillic words новый дом repeated 3 times.
I try to regex_replace each occurrance of these words.
For this I use std:: string format("$1 красный $2")
and regex pattern ("(\\W+)\\s+(\\W+)"),
The result is only the last occurrence is replaced,the 2 preceding ones are
not.
Where is my mistake?
My code:
#include <iostream>
#include <string>
#include "boost/regex.hpp"
using namespace std;
int main(int argc, const char** argv)
{
std::string str( "новый дом, новый дом новый дом" );
regex regx("(\\W+)\\s+(\\W+)");
std::string format( "$1 красный $2");
cout<<"regex_replace :"<