2 Replies Latest reply on Aug 14, 2018 9:10 AM by drewcifer2174

    Regex expressions for sting matching




      I'm new to regex and solarwinds. I'm trying to come up with a policy rule that checks GigabitEthernet0/2 - 0/45 for the command "switchport mode trunk" and alert me if it finds it on any of those specified ports.


      I have been unable to get anything to work. The best I've gotten is


      interface GigabitEthernet0\/([2-9]$|[1-3][0-9]$|4[0-5])\n\s*\S+\s\S+\s\S+\s\S+\n\s*switchport mode trunk


      This finds the interface line for the specified ports, skips the next line, and then checks the switchport mode line for trunk vs access. 


      interface GigabitEthernet0/44

      switchport access vlan 20

      switchport mode access

      switchport voice vlan 40

      spanning-tree portfast edge

      spanning-tree bpduguard enable


      Solarwinds searches the config (I made sure the downloaded config was current first) and says this:


      Below is a screenshot of my rule in solarwinds:




      Any help would be appreciated.