fork(2) download
  1. import re
  2. p = re.compile(r',?\+\d+_[^,]+')
  3. test_str = "+1223,+12_remove_me,+222,+2223_remove_me"
  4. result = p.sub("", test_str)
  5. print(result)
Success #stdin #stdout 0.02s 9016KB
stdin
Standard input is empty
stdout
+1223,+222