Apr-06-2019, 08:11 PM
(This post was last modified: Apr-06-2019, 08:11 PM by mrapple2020.)
Hello, if possible can someone assist to draft the following regex. I could first retrieve everything after "Outgoing Interface" like I did below. Then match with something like (TenGigE(.......))+ to retrieve the interfaces. I believe there is a better way to do it though with just one regex, but I can't figure it out. Thank you.
#Objective: I need to retrieve "Outgoing Interface" value. In the example below TenGigE0/5/0/1.200, TenGigE0/3/0/1". string = "[Incoming Interface List TenGigE0/5/0/1.200 Flags: Outgoing Interface List TenGigE0/5/0/1.201 Flags: F NS, Up: 01:06:23 blahblah TenGigE0/3/0/1 Flags:" #I tried: import re match = re.findall(r'(?:Outgoing Interface)(.*)', string) if match: #Got all Outgoing Interface output. Now retrieve interfaces: print(match)