-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Explain multiple pattern scenario #12920
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |||||||||||||||
| external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml | ||||||||||||||||
| Locale: en-US | ||||||||||||||||
| Module Name: Microsoft.PowerShell.Utility | ||||||||||||||||
| ms.date: 11/05/2025 | ||||||||||||||||
| ms.date: 04/02/2026 | ||||||||||||||||
| online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/select-string?view=powershell-7.4&WT.mc_id=ps-gethelp | ||||||||||||||||
| schema: 2.0.0 | ||||||||||||||||
| aliases: | ||||||||||||||||
|
|
@@ -706,7 +706,9 @@ Accept wildcard characters: True | |||||||||||||||
|
|
||||||||||||||||
| ### -Pattern | ||||||||||||||||
|
|
||||||||||||||||
| Specifies the text to find on each line. The pattern value is treated as a regular expression. | ||||||||||||||||
| Specifies the text to find on each line. The pattern value is treated as a regular expression. The | ||||||||||||||||
| parameter accepts multiple patterns in an array. If you specify more than one pattern, | ||||||||||||||||
| `Select-String` returns matches for each pattern. | ||||||||||||||||
|
Comment on lines
+709
to
+711
|
||||||||||||||||
| Specifies the text to find on each line. The pattern value is treated as a regular expression. The | |
| parameter accepts multiple patterns in an array. If you specify more than one pattern, | |
| `Select-String` returns matches for each pattern. | |
| Specifies the text to find on each line. By default, the pattern value is treated as a | |
| regular expression. Use **-SimpleMatch** to match the text literally. The parameter accepts | |
| multiple patterns in an array. If you specify more than one pattern, `Select-String` | |
| returns matches for each pattern. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |||||||||||||||
| external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml | ||||||||||||||||
| Locale: en-US | ||||||||||||||||
| Module Name: Microsoft.PowerShell.Utility | ||||||||||||||||
| ms.date: 11/05/2025 | ||||||||||||||||
| ms.date: 04/02/2026 | ||||||||||||||||
| online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/select-string?view=powershell-7.5&WT.mc_id=ps-gethelp | ||||||||||||||||
| schema: 2.0.0 | ||||||||||||||||
| aliases: | ||||||||||||||||
|
|
@@ -706,7 +706,9 @@ Accept wildcard characters: True | |||||||||||||||
|
|
||||||||||||||||
| ### -Pattern | ||||||||||||||||
|
|
||||||||||||||||
| Specifies the text to find on each line. The pattern value is treated as a regular expression. | ||||||||||||||||
| Specifies the text to find on each line. The pattern value is treated as a regular expression. The | ||||||||||||||||
| parameter accepts multiple patterns in an array. If you specify more than one pattern, | ||||||||||||||||
| `Select-String` returns matches for each pattern. | ||||||||||||||||
|
Comment on lines
+709
to
+711
|
||||||||||||||||
| Specifies the text to find on each line. The pattern value is treated as a regular expression. The | |
| parameter accepts multiple patterns in an array. If you specify more than one pattern, | |
| `Select-String` returns matches for each pattern. | |
| Specifies the text to find on each line. By default, the pattern value is treated as a regular | |
| expression. If you use **-SimpleMatch**, the pattern is matched literally. The parameter accepts | |
| multiple patterns in an array. If you specify more than one pattern, `Select-String` returns | |
| matches for each pattern. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |||||||||||||||
| external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml | ||||||||||||||||
| Locale: en-US | ||||||||||||||||
| Module Name: Microsoft.PowerShell.Utility | ||||||||||||||||
| ms.date: 11/05/2025 | ||||||||||||||||
| ms.date: 04/02/2026 | ||||||||||||||||
| online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/select-string?view=powershell-7.6&WT.mc_id=ps-gethelp | ||||||||||||||||
| schema: 2.0.0 | ||||||||||||||||
| aliases: | ||||||||||||||||
|
|
@@ -706,7 +706,9 @@ Accept wildcard characters: True | |||||||||||||||
|
|
||||||||||||||||
| ### -Pattern | ||||||||||||||||
|
|
||||||||||||||||
| Specifies the text to find on each line. The pattern value is treated as a regular expression. | ||||||||||||||||
| Specifies the text to find on each line. The pattern value is treated as a regular expression. The | ||||||||||||||||
| parameter accepts multiple patterns in an array. If you specify more than one pattern, | ||||||||||||||||
| `Select-String` returns matches for each pattern. | ||||||||||||||||
|
Comment on lines
+709
to
+711
|
||||||||||||||||
| Specifies the text to find on each line. The pattern value is treated as a regular expression. The | |
| parameter accepts multiple patterns in an array. If you specify more than one pattern, | |
| `Select-String` returns matches for each pattern. | |
| Specifies the text to find on each line. By default, the pattern value is treated as a regular | |
| expression. When you use **-SimpleMatch**, the value is interpreted literally. The parameter | |
| accepts multiple patterns in an array. If you specify more than one pattern, `Select-String` | |
| returns matches for each pattern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The -Pattern description states that the value "is treated as a regular expression", but this isn’t always true when -SimpleMatch is used (see the -SimpleMatch section, which says the Pattern value isn’t interpreted as regex). Consider rewording to "By default, the pattern is treated as a regular expression" (or cross-reference -SimpleMatch) so the behavior is accurately described.