fork(1) download
  1. import re
  2. strings = [
  3. 'title : Booking things author J smith',
  4. 'title : Unbe God author: K. sweet'
  5. ]
  6. for x in strings:
  7. m = re.search(r"(?:title\s*:?\s*)([\w\s]+)(?=author)", x)
  8. if m:
  9. print(m.group(1))
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
Booking things 
Unbe God