Re: [Boost-bugs] [Boost C++ Libraries] #589: regex_replace bug

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #589: regex_replace bug
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-13 20:52:31

#589: regex_replace bug
  Reporter: nobody | Owner: johnmaddock
      Type: Bugs | Status: closed
 Milestone: | Component: regex
   Version: None | Severity: Problem
Resolution: Invalid | Keywords:
Changes (by coffman@…):

  * severity: => Problem


 I have found this behavior still exists even when using posix basic or
 extended regexes. While this behavior may be correct for perl regexes it
 doesn't seem to be correct for posix basic or extended regexes.

 std::string s("a");
 const boost::regex e("(.*)", boost::regex::extended);
 std::string result = boost::regex_replace(s, e, "$&b");

 The result is "abb"

 If I use gnu's sed utility (GNU sed version 4.1.2) instead I get "ab"

 echo a | sed -r "s/(.*)/\1b/g"

 and gnu's sed utility claims to use posix extended regex expressions when
 called with the -r option.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC