Hi,
I am new to using boost and am trying to learn basics so I can use regex
features in my code.
In my test program, I want a function to simply extract some numbers that
follow after a certain string pattern and then to read those numbers into a
vector.
This is an outline of what i would like to do:
// function definition
#ifndef findnumbers.h
#define findnumbers.h
#include <string>
#include <fstream>
#include <vector>
#include
#endif
void findnumbers (ifstream& afile)
{
// assume file is opened in main - i have passed a reference
boost::regex expression ( ....having trouble with this);
// search for matches - there will be a fixed number of numbers e.g 10
std::string const_iterator start, end;
start = afile.begin( );
end = afile.end( );
std::vector<int> results;
boost::match_results what;
for(int count = 0; count !=10; count++)
{
boost::regex_search(start,end,what,expression)
{
//if a number is found place in the vector
results.push_back(count);
}
So the first problem I have is defining a correct expression. The pattern
has the format "sometext>NUMBERS