First remove single quote from begin,end of string before replacing escaped single quote.