0

I have done a multi-line find regex using Notepad++. The line begins with INFO and ends with a known digit pattern. When I click find after typing my regex, I get the correct results highlighted in the main window.

For my use case, I want to do find all in open documents using this same regex. The problem is when I do it, the find results window only shows the first line of the multi-line match. To be truly useful, I need the entire match (which in my case turns out to be 2 lines nearly all the time) displayed in the find results window. I wish to take the output of the find results screen and use it as input to another process which is beyond the scope of this question.

So how do I display the entire multi-line match. I can think of how to do this as a program in a scripting or programming language, but how can I do this from within Notepad++?

This question has an open bounty worth +50 reputation from Stobor ending in 10 hours.

This question has not received enough attention.

  • Can you provide the regex you are already using by chance? – Pimp Juice IT Aug 22 '17 at 0:06
  • 1
    If the same regex works in one part of Notepad++ and not the other, it's probably just a bug in Notepad++, and nothing we can help you with. You should file a bug in their issue tracker. – Patches Aug 28 '17 at 2:01
  • 1
    Notepad++ is pretty reliable, so I think you should post a test-case of 2 example documents and the regex find-string in question, in order to demonstrate the problem. If this is a bug, you will need in any case this example for posting a bug report, so you might as well demonstrate it here first. – harrymc Jun 20 at 5:47
  • @harrymc I don't think it's a bug; it's either a feature that's not obvious how to use, or it's not possible based on the current design. – Stobor 11 hours ago
  • @Stobor: The stated problem is very unclear. Notepad++ multi-line search works reliably and selects the entire multi-line text. Without an example your problem stays incomprehensible. – harrymc 8 hours ago
0

Try the following. Let's say your document starts with the word INFO and ends with 999.

Your regex would be:

INFO.+?999

In order for this to work with MULTI LINES, in the search window, right next to the tick for using Regular expression, there's a checkbox that says . matches newline. You need to have it selected for it to work.

p.s. Checked that it works on my Notepad++ version 7.5.1

p.s.2 The find only returns the 1st line of each occurrence. So if your match starts at line 5, but ends in line 10, it will display on the search window that it starts at line 5. You can't change that behavior in the application.

  • Hi Luis - I think your p.s.2 gets to the thing being asked for. In my case, I'm after a way to show all of lines 5 through 10 in the search window. – Stobor 11 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.