My data is structured like this:
[Unique ID1] Variable Name = Variable Value Variable Name = Variable Value Variable Name = Variable Value
[Unique ID2] Variable Name = Variable Value Variable Name = Variable Value Variable Name = Variable Value Variable Name = Variable Value
All I need to do is to extract the different parts, to be saved in a map. In my first callback, I divide every section into (a) Unique ID, and (b) rest of the (multiline) block. Once I have the latter, I make a call to a second callback to break the LHS and the RHS of each assignment expression.
So you say that the callback is really not required?
How about nested for-loops (caution untested code!!):
std::string text = get_text_from_file();
regex block_extractor("\\[(\\w+)\\]([^\\[]+)");
regex variable_extractor("(\\w+)\\s*=\\s*(\\w+)");
for(regex_iteratorstd::string::const_iterator i =
make_regex_iterator(text, block_extractor);
i != regex_iteratorstd::string::const_iterator(); ++i)
{
std::string block_name = i->str(1);
std::string block_contents = i->str(2);
std::map