I created the following helper function

    gsub_special <- function(pattern, replacement, x) {
        gsub(paste0("([^%]|^)", pattern), paste0("\\1", replacement), x)
    }