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: EmptyNow 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: AuthenticRustic
1 ) Homely
2 ) Simple
3 ) Urban
4 ) Plain
Correct Answer: UrbanBarren
1 ) Fertile
2 ) Depleted
3 ) Empty
4 ) Waste
Correct Answer: Fertile -
I would certainly try:
Find:
(?s-i)^Candidate Answer: .+\R
Replace: nothing
Search mode: Regular expression
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login