Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-07-23 01:27:13


Winson Yung wrote:
>> Sure, here is the zip file contain the test code compiled under
>> Visual C++ 6 as a console application. The code is bit of rough, but
>> it behave the same way as my app. I have included a raw.txt file. In
>> the file, the pattern is suppose to match line 2760, but instead it
>> seems to me it's matching line 4907.

OK I see the problem: when you sub-script the RegEx object you get the n'th
sub-expression of the *last match found* in the last operation. If you dump
the results in the vector you will see that a large number of matches were
indeed found. You could pass a vector<std::sting> to Grep to get the actual
strings that matched, or if you need more information then you'll have to
use a callback function.

Finally note that this is a legacy interface that is deprecated. There are
now better alternatives, for example regex_iterator or regex_token_iterator.

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net