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



  • 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



  • @Himanshu-Sindhi

    I would certainly try:

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


Log in to reply