Fixed infinite loop when replacement file contains "$&" characters