Syntax errors produced while replacing

The Replace command has introduced some errors in the code.