Community
    • Login

    Notepad++: Delete A line before and After of Specific Word in Files

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    4 Posts 2 Posters 357 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.
    • A
      alphaone
      last edited by alphaone

      Hello I’m Trying to

      Delete A line before and After a Word “IncorrMail” in my Documents Using Notepad++

      Like

      portgenerous3@hotmail.com:iiNUiwZ7B
      portgenerous3@hotmail.com:PZn7O5Rc9toh:2024-05-19

      falconboules@hotmail.com:Lavine1986
      IncorrMail

      pillarpitcher@hotmail.com:gy824SF4Jb
      pillarpitcher@hotmail.com:F8wuOixPTS8l4:2024-05-19

      beforebark52@hotmail.com:537EOUDsc537
      IncorrMail

      rondeauwendy42@hotmail.com:965nrgoyct96
      IncorrMail

      ====================

      On Above I want to remove a Line Before & After of Word IncorrMail

      i’m finding solution from last 10 days but still not getting

      please help me with Regax

      How can i do it?

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @alphaone
        last edited by

        @alphaone

        Try:

        Find: (?-si)^.*\R(.*?IncorrMail.*\R).*\R
        Replace: ${1}
        Search mode: Regular expression

        A 1 Reply Last reply Reply Quote 2
        • A
          alphaone @Alan Kilborn
          last edited by

          @Alan-Kilborn said in Notepad++: Delete A line before and After of Specific Word in Files:

          ${1}

          Thanks For The Reply

          I Tried Your Solution of Find Regax It’s Working But when i tried to Replace its’s not working

          i’m attaching the error screenshot

          (Screenshot (540).png image url)

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @alphaone
            last edited by Alan Kilborn

            @alphaone

            I Tried Your Solution of Find Regax It’s Working But when i tried to Replace its’s not working

            It appears you did a Find All in Current Document. For this search to find hits it doesn’t matter what the current caret position is.

            When you tried replace, your caret was further down in the file and no hits occurred between the position of the caret and the file’s end (the error message told you this: no occurrence was found from caret to end-of-file).

            Solution for replace: Either move the caret to the top of the file (Ctrl+Home), or checkmark the Wrap around checkbox, before pressing Replace.

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