Multiple String

Hi All,

I was trying to match multiple strings by using below code
$logfile = @"
$error_Log
"@ -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’

Please help…

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'

Thanks :slight_smile: