Fix token replacement on items with many matches.