(phixonline)--> with javascript_semantics string mltxt = """ <name> went for a walk in the park. <he or she> found a <noun>. <name> decided to take it home. """ sequence strings = {"<name>","<he or she>","<noun>"}, replacements = {"Pete","He","Rosetta Code Task"} integer startpos, endpos=1 while 1 do startpos = find('<',mltxt,endpos) if startpos=0 then exit end if endpos = find('>',mltxt,startpos) assert(endpos!=0,"missing >") string s = mltxt[startpos..endpos] assert(find(s,strings)) end while puts(1,substitute_all(mltxt,strings,replacements))