Correctly escape match string used in regex.