
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 :"<<regex_replace( str, regx, format ); return 0; } I use iMac Intel Core Duo, Mac OSX 10.6.8, IDE - Xcode 3.2.6 Thank you. egersheldster