I'm trying to find a regex pattern from list of strings. Specifically trying to return the ports.
data = '''348 VLAN0348 active Fa4/24, Fa4/26, Gi2/4
349 VLAN0349 active Fa6/40, Fa6/43, Fa6/45
350 VLAN0350 active Fa6/41, Gi3/40'''.split('\n')
Using this code I've been able sift out the first string, but I need the rest.
FoundPorts = []
if checkVlan in x:
port = re.search(r'active (\S*)',x)
if port != None:
FoundPorts.append(port.group(1))`
Ideally I'd get:
FoundPorts = ['Fa4/24','Fa4/26','Gi2/4','Fa6/40','Fa6/43','Fa6/45','Fa6/41','Gi3/40']