add text replacement function