• Login
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 634 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 Jun 2, 2024, 6:39 AM Jun 2, 2024, 6:35 AM

    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?

    A 1 Reply Last reply Jun 2, 2024, 12:36 PM Reply Quote 0
    • A
      Alan Kilborn @alphaone
      last edited by Jun 2, 2024, 12:36 PM

      @alphaone

      Try:

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

      A 1 Reply Last reply Jun 3, 2024, 3:16 AM Reply Quote 2
      • A
        alphaone @Alan Kilborn
        last edited by Jun 3, 2024, 3:16 AM

        @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)

        A 1 Reply Last reply Jun 3, 2024, 10:18 AM Reply Quote 0
        • A
          Alan Kilborn @alphaone
          last edited by Alan Kilborn Jun 3, 2024, 10:18 AM Jun 3, 2024, 10:18 AM

          @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
          4 out of 4
          • First post
            4/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors