use string.replace() method instead of expensive regex substitution