I have some texts and I would like to remove words. Each word for removing is in a std::vectorstd::string and I use a std::string for separating the words on the text. My first idea is to use the boost:split for splitting words of the text, in the result vector I remove the words, which should be removed, and recreate the text from the vector by concatination the elements. But another idea is to create a regexpr with the removing word and the separators and use regex_replace for removing.
Which idea is the better one or is there another way to removing word of a text?
I would create a regular expression of all the words you want to remove: \<(?:word1|word2|word3|word4)\> Then use regex_replace with "" as the replacement string. HTH, John.