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

The RE provided for the -match example is strange #11605

Open
3 tasks done
marcmcd opened this issue Dec 21, 2024 · 0 comments · May be fixed by #11611
Open
3 tasks done

The RE provided for the -match example is strange #11605

marcmcd opened this issue Dec 21, 2024 · 0 comments · May be fixed by #11611
Assignees
Labels
area-learn Area - Learn issue-doc-bug Issue - error in documentation

Comments

@marcmcd
Copy link

marcmcd commented Dec 21, 2024

Prerequisites

  • Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
  • Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Typo in Get-Foo cmdlet" instead of "Typo."
  • Verify Version: If there is a mismatch between documentation and the behavior on your system, ensure that the version you are using is the same as the documentation. Check this box if they match or the issue you are reporting is not version specific.

Links

https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/docs-conceptual/learn/ps101/05-formatting-aliases-providers-comparison.md

Summary

The RE provided for the -match example is strange:
'PowerShell' -match '^*.shell$'
^* matches 0 or more of the "start of string" (of which there can only be one)
and then the . in .shell$ matches any single character before the ending
substring "shell" ("r" in this case).

  PS> 'PowerShell' -match '^*.shell$'
  True
  PS> $matches

  Name                           Value
  ----                           -----
  0                              rShell

Details

No response

Suggested Fix

I believe you intended to provide the following example instead:

  PS> 'PowerShell' -match '^.*shell$'
  True
  PS> $matches

  Name                           Value
  ----                           -----
  0                              PowerShell
@marcmcd marcmcd added issue-doc-bug Issue - error in documentation needs-triage Waiting - Needs triage labels Dec 21, 2024
@sdwheeler sdwheeler added area-learn Area - Learn and removed needs-triage Waiting - Needs triage labels Dec 26, 2024
@mikefrobbins mikefrobbins linked a pull request Dec 27, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-learn Area - Learn issue-doc-bug Issue - error in documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants