Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Bookmark last non-empty line that placed before a specific line

I need a notepad++ regex that bookmark last non-empty line that placed before a specific line.
for example if my list is this:

Word1
Word 2
Word 3$
Word45

fghjyh

Q1

/////////////////////////

Commando1

Commando 43
Doctor##

44GGTT45

TTTTTT

QQQWW22
/////////////////////////

regex must bookmark following lines:

Q1
QQQWW22

I tried following regex but not working:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

^.+\S.+(?=^/{23}/)

how to fix this? where is my regex problem?

>Solution :

You can use

^\h*\S.*(?=\R+/{24})

Details:

  • ^ – start of a line
  • \h* – zero or more horizonatal whitespaces
  • \S – a non-whitespace char
  • .* – the rest of the line
  • (?=\R+/{24}) – immediately to the right of the current location, there must be one or more line breaks (\R+) and then 24 slashes.

See the regex demo.

Screenshot:

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading