Extracted variable pasteReplaceRegex, in order to avoid multiple regex recompilations.