Welcome › Forums › General PowerShell Q&A › Multiple String
This topic contains 2 replies, has 2 voices, and was last updated by
I was trying to match multiple strings by using below code
$logfile = @"
"@ -split "`n"
$logfile -notmatch 'String1' , 'String2',....
it is not working for me
but when i selecting only one string it is working
$logfile -notmatch 'String1'
The -match operator doesn't work that way. However, you can make a regular expression that does multiple patterns with its or operator (the pipe symbol). For example:
$logfile -notmatch 'String1|String2'
The topic ‘Multiple String’ is closed to new replies.