Ticket #2556 (closed Bugs: fixed)

Opened 8 years ago

Last modified 8 years ago

Perl regex replacement

Reported by: jcombe@… Owned by: johnmaddock
Milestone: Boost 1.38.0 Component: regex
Version: Boost 1.37.0 Severity: Problem
Keywords: Cc:


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:-


Where this matches I call replace with the following


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


With replacement


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


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


Change History

comment:1 Changed 8 years ago by johnmaddock

  • Status changed from new to assigned

Looks like a bug, or at least a missing feature.

Will fix.

John Maddock.

comment:2 Changed 8 years ago by johnmaddock

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [50370]) Fix gcc warnings from ICU wrappers. Add optional support for marked sub-expression location information. Add support for ${n} in format replacement text. Fixes #2556. Fixes #2269. Fixes #2514.


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.