Replace patterns saving in temp