Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6728115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:07:50+00:00 2026-05-26T10:07:50+00:00

From reading the FCD for regex_replace (28.11.4) I can only guess that the function

  • 0

From reading the FCD for regex_replace (28.11.4) I can only guess that the function can also use parts of the original string for replacing? I can not test it with my gcc, is this correct?

using namespace std;
regex rx{ R"((\d+)-(\d+))" }; // regex: (\d+)-(\d+)
cout << regex_replace("123-456", rx, "b: $2, a:$1");
// "b: 456, a:123"

As you can see, I assume $1 and $2 refer to the “()” capturing groups (and not \1 and \2 like elsewhere).

Update. So, I guess this is a two-part question

  • Is this use of capturing groups in the replacement text supported at all?
  • Is the default ECMAScript syntax using $n? Or \n?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:07:51+00:00Added an answer on May 26, 2026 at 10:07 am

    Table 139 in the C++ 2011 FDIS lists two constants that can be used to affect the rules used for the format string in regex_replace, format_default and format_sed. format_default is described as using “the rules used by the ECMAScript replace function in ECMA-262, part 15.5.4.11 String.prototype.replace.” This standard does indicate the use of $ for backreferences. See: ECMA-262

    Using the format_sed flag instead uses the rules for the sed utility in POSIX. Sed doesn’t appear to support $ backreferences.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From reading the RFC it appears that CID can/must only contain characters from the
From reading parts of the Programming in Scala book, I realize that Scala can
I know from reading Microsoft documentation that the "primary" use of the IDisposable interface
I am starting to learn AspectJ. From reading tutorials, I know that I can
I have a string from reading a .txt file that looks something like this:
From reading the docs I can tell that allowForceBuild will turn off the force
Can I use Delphi to program to the Java Native Interface ? From reading
From reading the Apple Docs on Core Data, I've learned that you should not
Can anyone point me in the right direction on this. From reading the FAQs
From reading the memory management docs in the SDK, I gathered that factory methods

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.