fork download
  1. import re
  2. email = 'MACHINE: =\nldnmdsbatchxl01\n\n\nMACHINE: p2prog06\n\n\nMACHINE: p1prog=^M\n07'
  3. res = list(set([re.sub(r'=(?:\^M)?|[\r\n]+', '', x) for x in re.findall(r'\bMACHINE:\s*(.*(?:(?:\r\n?|\n)\S+)?)', email, re.M)]))
  4. print(res)
Success #stdin #stdout 0s 23296KB
stdin
Standard input is empty
stdout
['ldnmdsbatchxl01', 'p2prog06', 'p1prog07']