Boost logo

Boost Users :

From: John Maddock (john_maddock_at_[hidden])
Date: 2003-03-14 06:53:43


> 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_results<std::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.


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