fork(2) download
  1. import re
  2.  
  3. file = """Mon Feb 19 22:25:19 2018 ABC.ls:9999: some text here, Mon Feb 19 22:25:19 2017
  4. Mon Feb 19 22:25:20 2018 ABC.ls:9999: some text here
  5. Mon Feb 19 22:25:20 2018 ABC.ls:9999: some text here, () with some more text"""
  6.  
  7. rx = re.compile(r'(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{2}:\d{2}:\d{2}\s\d{4}')
  8. res = []
  9. for s in file.splitlines():
  10. m = rx.search(s)
  11. if m:
  12. res.append(m.group())
  13.  
  14. print(res)
Success #stdin #stdout 0.01s 27784KB
stdin
Standard input is empty
stdout
['Feb 19 22:25:19 2018', 'Feb 19 22:25:20 2018', 'Feb 19 22:25:20 2018']