• Login
Community
  • Login

Finding and deleting entire paragraphs.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 2 Posters 1.8k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B
    byron blackmore
    last edited by May 3, 2018, 6:33 PM

    I would like to find all paragraphs in a document that do not contain “2016” and delete them. Is there an expression for that?

    S 1 Reply Last reply May 3, 2018, 6:38 PM Reply Quote 0
    • S
      Scott Sumner @byron blackmore
      last edited by Scott Sumner May 3, 2018, 6:40 PM May 3, 2018, 6:38 PM

      @byron-blackmore

      Probably but can you be precise as to what your meaning of paragraph is?

      1 Reply Last reply Reply Quote 2
      • B
        byron blackmore
        last edited by May 11, 2018, 5:25 PM

        Sorry for not replying earlier. I’ll watch more closely from now on. By paragraph I mean a string between paragraph markers. In notepad++ they show as two black boxes that say “CR LF”

        S 1 Reply Last reply May 11, 2018, 6:30 PM Reply Quote 0
        • S
          Scott Sumner @byron blackmore
          last edited by May 11, 2018, 6:30 PM

          @byron-blackmore

          Well, most people call what you’ve defined “lines” and not “paragraphs”, but that’s why I asked.

          You can remove all lines not containing 2016 as follows:

          Find what: ^((?!2016).)*\R
          Replace with: make sure this is empty
          Search mode: Regular expression

          1 Reply Last reply Reply Quote 3
          • B
            byron blackmore
            last edited by May 11, 2018, 7:17 PM

            That works. Thank you very much!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors