Powershell过滤器列表

时间:2018-04-26 13:32:29

标签: powershell

问题:如何同时过滤3个字符串'stringtomatch1'以及'stringtomatch2''stringtomatch3'

following允许您一次只过滤1个字符串:

[svn list -R PATHTOREPOSITORY | where {$_ -match 'stringtomatch'}]

1 个答案:

答案 0 :(得分:2)

-match将正则表达式作为参数,因此只需使用逻辑OR运算符|

svn list -R PATHTOREPOSITORY | ? {$_ -match 'stringtomatch1|stringtomatch2|stringtomatch3' }
相关问题