cancel
Showing results for 
Search instead for 
Did you mean: 

RegEx for Cisco interface

RegEx for Cisco interface

StephanH
Valued Contributor III

Hello,

for the comliance engine I have to find all interfaces not have a certain command line.

Here is a positive an a negativ example:

interface GigabitEthernet1/0/48
 description Test1
 switchport access vlan 830
 switchport mode access
 switchport voice vlan 310
 no cdp enable
!
interface GigabitEthernet1/0/49
 description Test2
 switchport mode trunk
 switchport nonegotiate
 queue-set 2
 mls qos trust dscp
 channel-group 1 mode active
 ip dhcp snooping trust

!

I am looking for an regex matching the hole interface 1/0/48 and NOT the interface 1/0/49.

The criterion should be, that all interfaces are found in which “mls qos trust dscp” is NOT present.

 

I tried  interface GigabitEthernet\d{1,2}\/\d{1,2}\/\d{1,2}[\s\n\w-].*?(?:(?<!mls qos trust dscp)[\s\n\w-])*?! but this regex match all interfaces and not only the 1/0/48.  But this is not working.

 

Any ideas?

Regards Stephan
1 ACCEPTED SOLUTION

StephanH
Valued Contributor III

Hello Mig,

your assumption was right, the compliance check does not support multiline regex, this is function as designed. This was the offical answer from GTAC.

 

Regards Stephan

View solution in original post

5 REPLIES 5

StephanH
Valued Contributor III

Hello Mig,

 I am in discussion with the sales team regarding an FR, yes.

 

 

Regards Stephan

Miguel-Angel_RO
Valued Contributor II

Hi Stephan,

A new feature request ?97db514298ce48f99d3b5b8c99fe7c0c_1f601.png

Mig

StephanH
Valued Contributor III

Hello Mig,

your assumption was right, the compliance check does not support multiline regex, this is function as designed. This was the offical answer from GTAC.

 

Regards Stephan

StephanH
Valued Contributor III

Hello Mig,

thank you for the hint. I will check this with the GTAC and I will update the topic here.

Regards Stephan
GTM-P2G8KFN