Here is a test case.
int main(int argc, char* argv[]) { boost::regex expression; std::string asFind[5];
expression.assign("(?!foo)bar", boost::regbase::perl);
asFind[0] = "foobar"; asFind[1] = "??bar"; asFind[2] = "barfoo"; asFind[3] = "bar??"; asFind[4] = "bar";
for( int i = 0; i < 5; i++ ){ std::string s = asFind[i]; std::string::const_iterator start = s.begin(); std::string::const_iterator end = s.end(); boost::match_resultsstd::string::const_iterator subexp; if (boost::regex_search( start, end, subexp, expression, boost::match_default)) { printf( "%s - Found.\n", s.c_str() ); } else { printf( "%s - Not Found.\n", s.c_str() ); } } return 0; }
The output is:
foobar - Not Found. ??bar - Not Found. barfoo - Found. bar?? - Found. bar - Found.
However, all the words should be "Found". Thank you for your time in advance.
Yes they should, it will be fixed in cvs shortly, thanks! John.