Say you want to find functions that uses parameters named like:-AsString
, -AsHashTable
, or -AsByteStream
Using Find-Member makes it easy.
That’s close, but I want it to start with a capital letter, to skip matches like:Assembly
or Asin
Converting Like to a Regex
The -like
pattern As*
is the same as the regex ^As
To start with a capital letter you could use: ^As[A-Z]
Disabling Case-Sensitive matches
Because PowerShell defaults to case-insensitive matches
You need to remove the i
insensitive flag using the syntax (?-i)
Solution
The final pattern is (?-i)^As[A-Z]
Making it case-sensitive narrowed down the matches from 113 to 43 !