Something
public text v1 · immutableBEGIN
s := '<p>The cat sat <b>on</b> the mat.</p>';
xhtml := '';
tag := '';
FOR i IN 1..10 LOOP
tag := substring(s from '<b>');
s := replace(s, tag, '');
END LOOP;
xhtml := s;
RETURN xhtml;