
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 vectorstd::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.