fork download
  1. import re
  2. line = "[ choice A | choice B ] and choose between [ choice D | choice F ]"
  3. line = re.sub(r"\[\s*([^][|]*?)\s*\|[^][]*]", r"\1", line)
  4. print(line)
Success #stdin #stdout 0.02s 9652KB
stdin
Standard input is empty
stdout
choice A and choose between choice D