How to search for strings that include newlines in Notepad++

5,312

If you use Extended search, you can search for \r\n as a newline when your document was created on windows. When it was created on linux, it is most likely only \n

So if you search for:

just looking\r\nfor a

It should find you the matches. To make exactly sure what to search for, press the button in the toolbar to enable showing all special chars.

Any CR is found searching for \r and any LF is found searching for \n.

Look closely for any spaces at the beginning and end of the line and search for those too.

Share:
5,312

Related videos on Youtube

user1021085
Author by

user1021085

Updated on September 18, 2022

Comments

  • user1021085
    user1021085 almost 2 years

    I'm going through subtitle files so there are stuff like

    442
    00:24:18,017 --> 00:24:20,551
    Now you're just looking
    for a scapegoat.

    and I'm wondering how I can search for "just looking for a" and have it find that. Right now "you're just looking" gets a match, "for a scapegoat" gets a match, "looking for" does not get a match.

    I've tried putting the search mode to normal/extended

  • user1021085
    user1021085 over 6 years
    I want to search different quotes and won't be sure where they did their lines breaks. Is there a way to just say "search this string, match even if it's broken up by new lines" or something?
  • LPChip
    LPChip over 6 years
    For that you will need RegEx, and check the option at the right to search past linebreaks.
  • user1021085
    user1021085 over 6 years
    I'm sorry how would that look like?
  • LPChip
    LPChip over 6 years
    I'm starting to think you are trying to do something with the wrong kind of tools or using the wrong method here. What is it exactly that you want to achieve in the end?
  • user1021085
    user1021085 over 6 years
    I want to be able to search through the subtitle files and find quotes (episode, context, etc)
  • LPChip
    LPChip over 6 years
    Then I would suggest to search/replace the entire file and remove all \r\n on lines. That would effectively merge all sentences to one sentence. You can then search freely.