Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain the replace operator's substitute-string syntax briefly and link to the relevant .NET help topic #5415

mklement0 opened this issue Feb 5, 2020 · 2 comments


Copy link

@mklement0 mklement0 commented Feb 5, 2020

Substitutions in Regular Expressions describes the syntax of the placeholder tokens you can use in -replace's <substitute> operand, notably:

  • $& represents the entire match
  • $1, $2, ... represents the first, second, ... capture-group match
  • $$ represents a verbatim $ char.

While documenting all such placeholders is beyond the scope of the topic, I suggest:

  • Adding the summary above, which may be enough to cover the majority of use cases.
  • (additionally, or at least) adding a link to the linked .NET topic.

Document Details

Do not edit this section. It is required for ➟ GitHub issue linking.


This comment has been minimized.

Copy link

@sdwheeler sdwheeler commented Feb 5, 2020

That reference is already linked to in the About_Regular_Expressions article. The about_Comparison_operators article is linked to about_Regular_Expressions. The operators article is not the place to get into the topic of regular expressions.

This is a duplicate of #4417

@sdwheeler sdwheeler closed this Feb 5, 2020

This comment has been minimized.

Copy link
Contributor Author

@mklement0 mklement0 commented Feb 5, 2020

I now see that contains the relevant information including the desired link, which is great.

However, that I missed this fact is no accident (and it sounds like I'm not the first person to do so) - please see #5416.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.