-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aNeeds-InvestigationThe behavior reported in the issue is unexpected and needs further investigation.The behavior reported in the issue is unexpected and needs further investigation.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
WildcardPattern.Escape() does not escape `, and as a result it's unreliable for escaping input for use in wildcard comparisons:
Define a string literal containing a single backtick character:
$string = 'abc`def'
Create an escaped copy of the string value:
$escaped = [WildcardPattern]::Escape($string)
Perform wildcard comparison and observe that it does not yield $true as expected:
$string -like $escaped
(That is: [WildcardPattern]::Escape($string) should produce a string value equivalent to 'abc``def', not return it as-is)
Expected behavior
PS> $string -like $escaped
TrueActual behavior
PS> $string -like $escaped
FalseError details
No response
Environment data
Name Value
---- -----
PSVersion 7.1.4
PSEdition Core
GitCommitId 7.1.4
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
mklement0, SeeminglyScience, santisq, BertDBBIPT, ArmaanMcleod and 1 more
Metadata
Metadata
Assignees
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aNeeds-InvestigationThe behavior reported in the issue is unexpected and needs further investigation.The behavior reported in the issue is unexpected and needs further investigation.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime