'Logic and spaces in Regex
I have the following Regex:
^(?P<port>[\w\-\>]+)(?P<virtual_route> +None|None)\s+(?P<port_state>\w)\s+(?P<link_state>[\w]+)\s+(?P<auto_neg>[\w]+)\s+(?P<cfg_speed>[\d]+) (?P<actual_speed>[\d\s]+)(?P<cfg_duplex>[\w]+)
That I use on the following configuration:
MLAG-ISC>None E A OFF 40000 40000 FULL FULL NONE 1 Q+CR4_1m
2 None E NP OFF 10000 FULL NONE
3 None E NP OFF 10000 FULL NONE
4 None E NP OFF 10000 FULL NONE
MLAG-ISC>None E A OFF 40000 40000 FULL FULL NONE 1 Q+CR4_1m
6 None E NP OFF 10000 FULL NONE
Which gives me this result (https://regex101.com):
This is the result I want however I would also like to capture the next FULL or empty, NONE or empty, 1 or empty and Q+CR4_1m or NONE. I just can't seem to make it work because of the spaces in the rows 2,3,4 and 6.
Note that I am using Python3.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

