I am writing a very simple program that extracts numbers from a string. The
numbers are actually lottery numbers.
So far, my program connects to a certain url and downloads a file that
contains the latest lottery results. I have managed to reach the point
where the barest amount of relevant data is contained in a std::string.
The data is in the following format - though of course the date and numbers
vary:
26-Jan-2013,2,6,21,29,34,47,11,X,X
Note I am not interested - at this stage - in the last two numbers
represented by X,X. I am only interested in the first seven numbers
following the date.
So I figured that it should be easy to write a regular expression to match
this pattern:
boost::regex pattern("\d\d\d\d,\\>(\\d{1,2})\\<,");
I have written a function called getnumbers that is declared as void
getnumbers(std::string data); This function should eventually be passed the
string (In the format above) and it should extract the first seven numbers
after the integer year in my pattern. It is not completed yet as I am stuck
now. I have asked for help before and it was suggested I use a
sregex_token_iterator - so the code below is just an effort to experiment
with this that I found in the documentation.
--------- function definition ---------
#include <string>
#include