PowerTip: Use PowerShell to Check String for a Match

Summary: Learn how to check a string to see if it contains another string. How can I use Windows PowerShell to check a string to see if it contains another string? Use the –Match operator: PS C:\> $a = [string]"This string contains a number of letters" PS C:\> $a -match 'a number' True