Powershell – OR operator in Select-string

Question:

In powershell is that a way to put multiple search pattern ? Example below command, I want to search those string that has ASA or TMP. But it doesn’t work. The search should match as a single word example: ASA is true but TIASAP is false

Answer:

If you omit the -SimpleMatch switch, the Select-String cmdlet uses regex so you can just search for ASA|TMP:

Source:

Powershell – OR operator in Select-string by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply