Regular expression doesn't produce expected result

UPDATE

If you insist on using a regex to track the failures, you could do something like the following:

for i in s.split('\n'):
    number = re.findall(r'^\d+', i)
    if number: failure = re.findall(r'^(\d+)\.(.*?)\s_{2,}', i)
    if 'failed' in i:
        print(failure)

Returns:

[('9', 'TX_MULTI_VERIFICATION 2412 DSSS-1 NON_HT BW-20 TX1')]
[('11', 'TX_MULTI_VERIFICATION 2472 DSSS-1 NON_HT BW-20 TX1')]
[('12', 'TX_MULTI_VERIFICATION 2412 CCK-11 NON_HT BW-20 TX1')]

You can see a form of this regex in action here.

Leave a Comment