开发者

Powershell match a single string against multiple regexs?

开发者 https://www.devze.com 2022-12-19 07:58 出处:网络
Is there a more \'powershelly\' way of matching a single string against an array/collection of regexes other than iterating through each one in turn?

Is there a more 'powershelly' way of matching a single string against an array/collection of regexes other than iterating through each one in turn?

What I'd rea开发者_开发知识库lly like to be able to do is something this

$database.Name -match $includeRegexArray

Given the way Powershell works it feels like there should be a nicer solution than writing a function to iterate over the array


Select-String will accept an array of regex patterns:

Select-String $includeRegexArray -inp $database.Name
0

精彩评论

暂无评论...
验证码 换一张
取 消