regex_replace
#include <iostream> #include <string> #include <boost/regex.hpp> int main() { boost::regex reg("(Colo)(u)(r)", regbase::extended | regbase::icase); std::string s="Colour, colours, color, colourize"; s=boost::regex_replace(s,reg,"$1$3"); std::cout << s; } #g++ test.cpp -lboost_regex #./a.out Color, colors, color, colorize