fork download
  1. import re
  2. email = ' MACHINE: \nldnmdsbatchxl01\n\n\nMACHINE: p2prog06\n\n\nMACHINE: p1prog\n07'
  3. res = [m.group(1).replace("\n", "").replace("\r", "") for m in re.finditer(r'\bMACHINE:\s*(.*(?:\s*^\d+)?)', email, re.M)]
  4. print(res)
Success #stdin #stdout 0.01s 27792KB
stdin
Standard input is empty
stdout
['ldnmdsbatchxl01', 'p2prog06', 'p1prog07']