Boost logo

Boost :

From: Jorge Lodos (lodos_at_[hidden])
Date: 2007-03-30 11:21:54

I'm using xpressive 1.0.1 from the vault (thanks for a great library BTW).
When using static regexes and regex_token_iterators, dereferencing the
iterator does not always give the expected matching string.
Take for instance the example 5 about splitting a string into tokens that
each match a regex. If you use
sregex time = (_d) >> ':' >> (_d >> _d);
instead of
sregex time = sregex::compile( "(\\d):(\\d\\d)" );
the output is empty for the input string "Eric: 4:40, Karl: 3:35, Francesca:
The first impression while debugging is that grouping is not working. The
first match on this sample is "4:40" instead of expected "4". I decided to
ask for help before continue debugging, just in case this was already known.

For completeness, here is the rest of the sample code:

int const subs[] = { 1, 2 };
sregex_token_iterator cur( str.begin(), str.end(), time, subs );
sregex_token_iterator end;
for( ; cur != end; ++cur )
   std::cout << *cur << '\n';

Thanks in advance.


Boost list run by bdawes at, gregod at, cpdaniel at, john at