Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2005-08-16 04:55:57


> In boost/regex/v4/regex_match.hpp, a number of the overloads (the ones
> that don't take a result parameter) are now bitwise-oring in
> regex_constants::match_any.
>
> As a result, a sequence like
>
> boost::regexp exp("a(bc)?")
> char *value = "abcbc";
> bool result = boost::regex_match(value, value + 5, exp);
>
> will now set result to true where it was previously false in 1.32. I
> fixed our code by passing in a dummy result object as an extra
> parameter.
>
> Was this change intentional? I couldn't find any documentation that
> mentions it.

It's intentional in the sense that or'ing with match_any *should never
effect whether a match is found or not*, only which or several possible
matches gets selected.

I can't reproduce your problem here, here's the test code I'm using:

#include <boost/regex.hpp>
#include <iostream>

int main()
{
  boost::regex exp("a(bc)?");
  const char *value = "abcbc";
  bool result = boost::regex_match(value, value + 5, exp);
  return result;
}

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