How can I delete everything before and after text that selected by regex? [Notepad++]

Issue

This Content is from SuperUser. Question asked by alex leiy

I am currently editing down multiple large text files , and need to delete everything before and after text that selected by this Regex ^NewPage.+?NewPage$

For example i have this text:

V.prototype.Jb=function(){if(!this.N)  
_.k.Zj=function(a){this.H=a;dj(this,this.O);  
var Vi=function(a,b){this.B=new Oi(this);  
NewPage 1969 Q2","Fortran","2.49","NewPage  
V.prototype.Jb=function(){if(!this.N)  
_.k.Zj=function(a){this.H=a;dj(this,this.O);  

and i want to remove everything except this line:

NewPage 1969 Q2","Fortran","2.49","NewPage

Note : i must use regex because i want to edit multiple text files



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from SuperUser , is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?