fork(3) download
  1. import re
  2.  
  3. strings = ["00000 Gin-a19ea68e-64bf-4471-b4d1-44f6bd9c1708-62fa6ae2-599c-4ff1-8249-bf6411ce3be7-83930e63-2149-40f0-b6ff-0838596a9b89 Kin",
  4. "00000 Gin-a19ea68e-64bf-4471-b4d1-44f6bd9c1708 Kin"]
  5.  
  6.  
  7. rx = re.compile(r'^[^-]+')
  8. new_strings = [match.group(0)
  9. for string in strings
  10. for match in [rx.search(string)]
  11. if match]
  12. print(new_strings)
Success #stdin #stdout 0.02s 9992KB
stdin
Standard input is empty
stdout
['00000 Gin', '00000 Gin']