fork download
  1. import re
  2. rx = r'/(\w+(?:\W+\w+)+\W*$)?'
  3. strs = ['CENTRAL CARE HOSPITAL/HOPITAL CENTRALE DE SOINS','ELEMENTARY/INSTITUTION','FOUNDATION INSTITUTION/FUNDATION DEL INSTITUTO','HAPPY SPRING BREAK 20/20']
  4. for s in strs:
  5. print( re.sub(rx, lambda x: "" if x.group(1) else " ", s) )
  6.  
Success #stdin #stdout 0.03s 9496KB
stdin
Standard input is empty
stdout
CENTRAL CARE HOSPITAL
ELEMENTARY INSTITUTION
FOUNDATION INSTITUTION
HAPPY SPRING BREAK 20 20