Mar-20-2023, 05:37 PM
something like that
import re s = "<RF><b>1:4 <b>Hom wat is ... kom:</b>" def repl(match, count=[0]): x, = count count[0] += 1 if x > 0: return '' return '<b>' print(re.sub('<b>', repl, s))
Output:<RF><b>1:4 Hom wat is ... kom:</b>