Modify regular replace method