import re
strs = ["GN1RLWFH0546-2020-04-10-18-09-52-563945.txt", "JOHN-DOE-2020-04-10-18-09-52-563946t64.txt", "DESKTOP-OHK45JO-2020-04-09-02-27-11-451975.txt"]
rx = re.compile(r"^.*?(?=-\d+-)")
for s in strs:
  m = rx.search(s)
  if m:
  	print("{} => '{}'".format(s, m.group()))