I want to find any file that can match two regular expressions, for example all files that have at least one of bat
, hat
, cat
as well as the word noun
. That would be any file that can match both regular expressions [bhc]at
and noun
.
The regex parameter to select-string
only seems to work on a line-by-line basis. It seems you can pass in multiple patterns delimited by commas (select-string -pattern "[bhc]at","noun"
) but it matches either, rather than both.