`replace` does not modify the string it's called on -- it returns a new string. So I don't think this will work as-is.