Remove replace-regexp in non-interactive function