Looking for some assistance with a regex. My skills are pretty elementary and I haven't been able to find the answer.
I'm using regex it to go though a config file, and want to confirm that interface GigabitEthernet1/1/1 is not trunking vlan 4052-4092. Since the config spans multiple lines, and there may be different config elements between the interface and trunking statements, I was trying to do it using something like this:
GigabitEthernet1\/1\/1[\s\S]*?(vlan.*40[5-8][0-9]|9[12])
This works if GigabitEthernet1/1/1 has a 40xx vlan in the allowed statement, but if doesn't, the search continues until it finds it's match on the next interface. Is there a way I can get the regex to stop looking once it hits the end of the 1/1/1 interface configuration?
interface GigabitEthernet1/1/1
description link-to-someswitch-Gi2/0/1
switchport access vlan 3109
switchport trunk allowed vlan 300,301,350,358,800,3109
switchport trunk encapsulation dot1q
switchport trunk native vlan 3109
switchport mode dynamic desirable
srr-queue bandwidth share 40 20 20 20
srr-queue bandwidth shape 10 0 0 0
priority-queue out
no snmp trap link-status
mls qos trust dscp
spanning-tree portfast disable
!
interface GigabitEthernet1/1/2
description link-to-someswitch2-Gi2/0/1
switchport access vlan 3609
switchport trunk allowed vlan 300,301,350,358,800,3609,4088
switchport trunk encapsulation dot1q
switchport trunk native vlan 3109
switchport mode dynamic desirable
srr-queue bandwidth share 40 20 20 20
srr-queue bandwidth shape 10 0 0 0
priority-queue out
no snmp trap link-status
mls qos trust dscp
spanning-tree portfast disable
Thanks for the help. I should mention that this inst' for application into a specific programming language, but rather going into a management system that supports regex for finding elements that a config file should or shouldn't include.