Multiple String

Welcome Forums General PowerShell Q&A Multiple String

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 10 months ago.

  • Author
    Posts
  • #37878

    Participant
    Points: 0
    Rank: Member

    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...

  • #37881

    Member
    Points: 0
    Rank: Member

    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'
    
  • #38096

    Participant
    Points: 0
    Rank: Member

    Thanks 🙂

The topic ‘Multiple String’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort