Modified letter_replace to use regex.