Nit: the replacement should only happen if the match is the first characters in the string.