Notepad++ : Select specific line with Next 3 lines or above 3 lines

Mode : regular Expression . 
Find What : (ফতোয়া নং:.*)(.*\R){4} 
Replace : =======================\n\1\n
(This will delete the next three lines  and set ====== ) 

-------------------------------------------------------------------


Hello Jeff and All,
As Jim, said in his post : with a scripting language, no file can resist :-)) However, as usual, the N++ regex engine should be enough, to get what you want :-))
simple example : let’s suppose that you are looking for the litteral string 12345anywhere, on a line.
  • First, to match all the contents of that specific line, as well as its End of Line characters, just use the regex :^.*12345.*\R
  • Secondly, to select :
    • All the contents of that line and the next 10 lines, use the regex : ^.*12345.*\R(.*\R){10}
    • All the contents of that line and the previous 10 lines, use the regex : (.*\R){10}^.*12345.*\R
    • All the contents of that line and the 5 lines, before and after this line, use the regex : (.*\R){5}^.*12345.*\R(.*\R){5}
Note : For the third example, an other syntax, that uses a subroutine call, to the group 1(?1), is possible : (.*\R){5}^.*12345.*\R(?1){5}
That’s all !!
Best Regards,
guy038

No comments:

Post a Comment

Featured Post

Lesson 1 : Android Studio : DownLoad And Install and First App

বিসমিল্লাহির রাহমানির রাহীম Lesson 1 : Android Studio : DownLoad And Install  and First App এই লেসনটির ভিডিও ইউটিউবে দেখতে এখানে ক্ল...

Popular Posts