fork download
  1. import re
  2. array = ['GW-date45:ger-date45:mySAPgives','DC-date48ccc:date48:mySAP']
  3. hostname = []
  4. for node in array:
  5. m = re.search(r'^[^-]*-([^:]+)', node)
  6. if m:
  7. hostname.append(m.group(1))
  8.  
  9. for line in hostname:
  10. print(line)
Success #stdin #stdout 0.02s 9624KB
stdin
Standard input is empty
stdout
date45
date48ccc