[Boost-bugs] [Boost C++ Libraries] #2556: Perl regex replacement

Subject: [Boost-bugs] [Boost C++ Libraries] #2556: Perl regex replacement
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-12-01 16:33:44


#2556: Perl regex replacement
-------------------------------+--------------------------------------------
 Reporter: jcombe_at_[hidden] | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: Boost 1.38.0 | Component: regex
  Version: Boost 1.37.0 | Severity: Problem
 Keywords: |
-------------------------------+--------------------------------------------
 I have code that reads a lookup table from memory and then attempts to
 search for the word found in the lookup table in some data using a regular
 expression:-

 (.*\b)word(\b.*)

 Where this matches I call replace with the following

 $1WORD$2

 This falls down when the word is "2lt" as I get the following to search
 for

 (.*\b)2lt(\b.*)

 With replacement

 $12LT$2

 What happens is it sees $12 as the substring to replace and since I only
 have two pairs of brackets in my regular expression $12 does not exist and
 so in effect the 2 in my input data is lost.

 I am using Perl format regular expressions (boost::regex::perl)

 In Perl I can resolve this by making the replacement

 ${1}2LT${2}

 When I do this using boost I get the literal text as above output
 (including ${1} etc.) not the text that I expect. Since I've told Boost to
 use Perl syntax I would expect a regular expression replacement in Perl
 and Boost to behave the same way.

 Is this a bug ?

 Thanks
 Jon

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2556>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC