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

Closed
mklement0 opened this issue Feb 5, 2020 · 2 comments

Comments

@mklement0
Copy link
Contributor

@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 docs.microsoft.com ➟ GitHub issue linking.

@sdwheeler

This comment has been minimized.

Copy link
Collaborator

@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
@mklement0

This comment has been minimized.

Copy link
Contributor Author

@mklement0 mklement0 commented Feb 5, 2020

I now see that https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-7#substitutions-in-regular-expressions 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
Projects
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.