0

I need to do a search in jEdit for a string starting with the end of the last empty line up to another string:

blah
blah 
blah 
blah
blah 
empty line
empty line
empty line *start here*
blah 
blah
blah blah blah
blah
blah
blah ------ Running ------

The idea is to do a search and replace to remove everything (i've bolded) before the string ------ Running ------ but not the lines or strings before that last line.

Can someone suggest the proper regex to find from end of last line up to the beginning of the string ------ Running ------ ?

Thanks!

alphablender
  • 2,168
  • 5
  • 27
  • 42

1 Answers1

2

Use the below regex and then remove the matched string with an empty string.

(?s)(?<=\n)(?:(?!\n\n).)*\n(?=[^\n]+------ Running ------)

Java regex would be,

(?s)(?<=\\n)(?:(?!\\n\\n).)*\\n(?=[^\\n]+------ Running ------)

DEMO

Avinash Raj
  • 172,303
  • 28
  • 230
  • 274