use replace-match to replace matches