[Boost-bugs] [Boost C++ Libraries] #3389: Replacement format operator to substitute sequential numbers

Subject: [Boost-bugs] [Boost C++ Libraries] #3389: Replacement format operator to substitute sequential numbers
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-09-02 09:52:37


#3389: Replacement format operator to substitute sequential numbers
-------------------------------------------------+--------------------------
 Reporter: Keith MacDonald <keith@…> | Owner: johnmaddock
     Type: Feature Requests | Status: new
Milestone: Boost 1.41.0 | Component: regex
  Version: Boost 1.40.0 | Severity: Not Applicable
 Keywords: regex format syntax |
-------------------------------------------------+--------------------------
 I'd like to suggest an enhancement to the Boost-Extended format string
 syntax. Its syntax is one of:

 {{{
 \i
 \i(n)
 }}}

 The former substitutes sequential numbers, starting at 1, while the (n)
 modifier starts the sequence at value <n>. For example, given this text:

 {{{
 #define FOO 52
 #define BAR 53
 }}}

 Searching for "[0-9]+" and replacing with "\i(100)" would result in:

 {{{
 #define FOO 100
 #define BAR 101
 }}}

 Each \i in the replacement format is treated independently, so searching
 for ". ." in the following text:

 {{{
 a b
 c d
 }}}

 and replacing it with "\i \i(20)" would result in:

 {{{
 1 20
 2 21
 }}}

 A useful variation would be the ability to specify the field width
 required, perhaps using "\i(n,w)", for leading spaces, and "\i(n,0w)" for
 leading zeroes.

 Thanks

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3389>
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:50:01 UTC