Skip to content

Clarified \g and \k backreferences in Boost regex. - #897

Open
pbarney wants to merge 1 commit into
notepad-plus-plus:masterfrom
pbarney:pbarney-backreference-clarification-1
Open

Clarified \g and \k backreferences in Boost regex.#897
pbarney wants to merge 1 commit into
notepad-plus-plus:masterfrom
pbarney:pbarney-backreference-clarification-1

Conversation

@pbarney

@pbarney pbarney commented Aug 17, 2026

Copy link
Copy Markdown

According to Boost's source code, \g and \k backreferences are synonymous. This edit removes any ambiguity that may remain in the reader's mind regarding when to use one or the other.

Fixes #896

According to Boost's source code, \g and \k backreferences are synonymous. This edit removes any ambiguity that may remain in the reader's mind regarding when to use one or the other.
@pryrt pryrt added the needs improvement will not be accepted until improvements are made label Aug 17, 2026
@pryrt

pryrt commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

If you must clarify these, then do it as a subpoint to the already existing bullet point, don't put your "caveat" before those symbols are defined.

Comment thread content/docs/searching.md

* `(?<name>`_subset_`)` or `(?'name'`_subset_`)` ⇒ _Named Capture Group_: Names the value matched by _subset_ as the group _name_. Please note that group names are case-sensitive.

* `\g` and `\k` are functionally synonymous prefixes for _extended backreferences._ There is no semantic difference in Boost's implementation. They coexist for syntax-compatibility/historical reasons.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be moved down... I would say move it after the For negative ℕ a few paragraphs down, and make it have the same indentation as that note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs improvement will not be accepted until improvements are made

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SEARCHING] Difference between \g and \k is not addressed.

2 participants