It depends on what you want to do with the code.
If you want a vector of all the words or a particular one
// set text equal to something ...
boost::regex_split(std::back_inserter(Aout), Text, Re); // Destroys Text string in process
The regex expression is not great, (or is that what you are after)?
but you can fill anything you like in there. There are a lot of different ways of using regex, the boost site has an extensive user manual.
Can you be a bit more specific, it this is not what you want?
Ok the question really has highlighted just how ignorant I am about
I have a solution to the problem BUT I don't think it is elegant and
I am sure that others know how to do this properly.
Anyway here is what I have:
std::string Out; // output space
// Text set somehow or use iterators to a stream
Out+=' '; // add space .
Now you might like to add the space into the regex code and then
not worry about the word spacing, but you can experiment.
What I am not sure of is m1!=empty the best way to terminate this?
If you figure it out something better or anyone else please add a comment.