Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2004-06-12 05:06:15


> regex_replace("XX",regex("X", boost::regex::literal), "Y")
>
> returns "YXY" instead of "YY" whereas the (even more) trivial case
>
> regex_replace("X",regex("X", boost::regex::literal), "Y")
>
> returns "Y" as expected.
>
> I am using boost_1_31_0 compiled with VC6(SP5). In addition, I have
> applied the patches from the package
> boost-1.31.0-regex-patch-20040503.
>
> What is going wrong here?

Well it's a bug, here's the patch that's going into cvs now:

RCS file: /cvsroot/boost/boost/boost/regex/v4/perl_matcher_common.hpp,v
retrieving revision 1.18.2.3
diff -u -r1.18.2.3 perl_matcher_common.hpp
--- boost/regex/v4/perl_matcher_common.hpp 3 May 2004
11:31:15 -00001.18.2.
3
+++ boost/regex/v4/perl_matcher_common.hpp 12 Jun 2004 10:04:47 -0000
@@ -54,7 +54,7 @@
    estimate_max_state_count(static_cast<category*>(0));
    if(!(m_match_flags & (match_perl|match_posix)))
    {
- if(re.flags() & regex_constants::perlex)
+ if((re.flags() & regex_constants::perlex) || (re.flags() &
regex_constants::literal))
          m_match_flags |= match_perl;
       else
          m_match_flags |= match_posix;

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