fork(1) download
  1. import re
  2. list_strings = ['[ABC1: text1]', '[[DC: this is a text]]', '[ABC-O: potatoes]', '[[C-DF: hello]]']
  3.  
  4. #remove from [ up to :
  5. for string in list_strings:
  6. cleaned = re.sub(r'^\[+[A-Z\d-]+:\s*|]+$', '', string)
  7. print(cleaned)
Success #stdin #stdout 0.02s 9476KB
stdin
Standard input is empty
stdout
text1
this is a text
potatoes
hello