Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Where子句中的PowerShell转义下划线_Powershell - Fatal编程技术网

Where子句中的PowerShell转义下划线

Where子句中的PowerShell转义下划线,powershell,Powershell,我希望过滤掉以下划线[某些数值]结尾的结果,例如Thing_20201116 | Where-Object {$_.name -NotLike "_*"} Powershell v5.1 我做错了什么? 感谢您的帮助善良的人们:)您可以使用*.-这将是任何带有u的东西 更具体地说,您需要-notmatch,它接受一个正则表达式(请参阅和的参考。) 例如: ls | Where-Object {$_.Name -notmatch "_\d+$"} 将-

我希望过滤掉以下划线[某些数值]结尾的结果,例如Thing_20201116

 | Where-Object {$_.name -NotLike "_*"}
Powershell v5.1

我做错了什么?
感谢您的帮助善良的人们:)

您可以使用
*.
-这将是任何带有u的东西

更具体地说,您需要
-notmatch
,它接受一个正则表达式(请参阅和的参考。)

例如:

ls | Where-Object {$_.Name -notmatch "_\d+$"}

将-notmatch与正则表达式一起使用:
|其中对象{$\名称-notmatch“\ud”}