gsub before begin