Community
    • Login

    How to replace "a line containing a particular word" with "empty line" in notepad++

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 509 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.
    • Himanshu SindhiH
      Himanshu Sindhi
      last edited by Himanshu Sindhi

      I have a file like this…

      Virtual
      1 ) Fundamental
      2 ) Implied
      3 ) Indirect
      4 ) Authentic
      Correct Answer: Authentic
      Candidate Answer: Authentic
      Rustic
      1 ) Homely
      2 ) Simple
      3 ) Urban
      4 ) Plain
      Correct Answer: Urban
      Candidate Answer: Urban
      Barren
      1 ) Fertile
      2 ) Depleted
      3 ) Empty
      4 ) Waste
      Correct Answer: Fertile
      Candidate Answer: Empty

      Now I want to remove the lines containing “Candidate Answer: xyz” with an empty line.
      Like this…

      Virtual
      1 ) Fundamental
      2 ) Implied
      3 ) Indirect
      4 ) Authentic
      Correct Answer: Authentic

      Rustic
      1 ) Homely
      2 ) Simple
      3 ) Urban
      4 ) Plain
      Correct Answer: Urban

      Barren
      1 ) Fertile
      2 ) Depleted
      3 ) Empty
      4 ) Waste
      Correct Answer: Fertile

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

        @Himanshu-Sindhi

        I would certainly try:

        Find: (?s-i)^Candidate Answer: .+\R
        Replace: nothing
        Search mode: Regular expression

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