fork(1) download
  1. import re
  2.  
  3. prohibitedWords = [r'[Tt]o:\s*','\b002;\s*',"\s*<([^<>]*)>"]
  4. mystring = 'To: John Lennon <John.Lennon@gmail.com> \b002; Paul McCartney <Paul.McCartney@yahoo.com> \b002;'
  5. big_regex = re.compile('|'.join(prohibitedWords))
  6. the_message = big_regex.sub("", str(mystring)).strip()
  7. print(the_message)
Success #stdin #stdout 0.02s 9572KB
stdin
Standard input is empty
stdout
John Lennon Paul McCartney