Regex: public void set([^\{]+)\{(\W*)this\.([^;]+);(\W*)} Replace: public void set$1\{$2this\.$3;$4}\n\n\tpublic HistoricTaskQueryRepresentation with$1\{$2this\.$3;$2return this;$4}