This is just a thought, but if you were replacing words with regex and you wanted to count how many words you replaced then how would you do that?
https://duckduckgo.com/?q=regex+count+occurrences&t=ffsb&ia=qa
it might be easier to read (and write, and debug, etc) if you do a count-if though?
Last edited on
@Thomas1965 "Why don't you use a stringstream or even strtok to split replace and count ?"
I haven't heard of them.
Stringstreams are very useful so you should have a look at them.
For this task maybe stick with regex.
Ok thanks for the tip, I'll check them out.