fork download
  1. import re
  2. rx = r"([A-Z]+(?:\W+\w+)?)\s*—"
  3. s = "|[<p>Advertisement , By MILAN SCHREUER and ALISSA J. RUBIN OCT. 5, 2016 \n, BRUSSELS — A man wounded two police officers with a knife in Brussels around...] \n[<p>Advertisement , By DAVID JOLLY FEB. 8, 2016 \n, KABUL, Afghanistan — A Taliban suicide bomber killed at least three people on Mo"
  4. print(re.findall(rx, s))
  5.  
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
['BRUSSELS', 'KABUL, Afghanistan']