`.Contains()`, `-contains`, `-match`, `-like`
It's about time that I did a note for myself on the difference between these two in PowerShell - I never can remember what the nuances are.
.Contains()
This is a .NET method on the string type. It is strictly case-sensitive!
There are several additional options that it could take, one of which will make the search case-insensitive.
'hello'.Contains('ELLO', [StringComparison]::OrdinalIgnoreCase)
Here is the full documentation for the method, and here is the documentation for the [StringComparison] enum.
-contains
This is to check membership of an array! Don't get it confused!
-match
This performs similarly to .Contains, but uses regex.
It automatically populates a variable called $matches with the captured groups.
-like
Similar again, for pattern matching on strings, SQL style.
Here is a full description of comparison operators in PowerShell.