Given a set of keywords, I would like to list each one that I find in a text block (including, say, the offset). Then I will fill the block with new text and search again until there is no more text to search.
I would like to use Boost regex since my understanding is that it is probably more efficient than a simple approach that I could come up with by using only C++ and STL. (BTW, I cannot use C++11.) Boost should also allow the program to be built on both Windows and Linux without platform dependent code. I have hardly used regex, so, if there is a tidy C++ solution, then I hope you will throw in a few words to help me understand the regex part so that I can add appropriate comments.
If possible, could you show the C++ function code? I can only use Boost and standard STL libraries, and standard C++ code.