So, how could I achieve that? Could I still use boost::regex_grep?
There are a couple of options: one would be to combine all your regexes into one big expression, each with a different sub-expression index so you can tell which one was matched: (expression-1)|(expression-2)|(expression-3) The other option would be to call regex_grep (which has been deprecated in favour of regex_iterator BTW) with non-constant iterators, then you could fill the area matched with whitespace in preparation for the next match: std::string text(whatever); boost::regex re(expression_text); boost::regex_iteratorstd::string::iterator i(text.begin(), text.end(), re), j; while(i != j) { // do something with *i here, then: std::fill((*i)[0].first, (*i)[0].second, ' '); ++i; } Get the idea? John.