fork download
  1. import re
  2. rx = r"^[^:-][^:]*"
  3. text = "enx002: connected to Wired connection 2\ndocker0: connected to docker0\nvirbr0: connected to virbr0\ntun0: connected to tun0"
  4. print( re.findall(rx, text, re.M) )
  5. print( re.findall(r'^([^:\n-][^:\n]*):', text, re.M) )
  6.  
Success #stdin #stdout 0.02s 9468KB
stdin
Standard input is empty
stdout
['enx002', 'docker0', 'virbr0', 'tun0']
['enx002', 'docker0', 'virbr0', 'tun0']