Use #gsub with block

because replacement string may contain special characters