John
John

Reputation: 16007

How do I match an entire line in Notepad++ for search/replace?

I'd like to do a bulk line-by-line replace on a file within Notepad++ like so:

This is my line of text that I would like to replace

to

"This is my line of text that I would like to replace" +

I tried the following:

Find: ^$ Replace: "\1" +

Find: ^()$ Replace: "\1" +

Find: (^$) Replace: "\1" +

Any hints? Thanks in advance!

Upvotes: 18

Views: 26877

Answers (4)

Dennis
Dennis

Reputation: 14477

Try this:

Find: ^(.*?)$

Replace: "\1" +

Upvotes: 6

MRR0GERS
MRR0GERS

Reputation: 654

Try this and see if it works for you:

Find: ^(.+)$ Replace: "\1" +

Upvotes: 1

Kristof Mols
Kristof Mols

Reputation: 3557

This should work:

Find (.*) replace "\1" +

Upvotes: 1

Marcus
Marcus

Reputation: 12596

Try to search for ^(.*)$ and replace with "\1" +

The difference between this and your's is that this one captures all characters between the starting and ending of the string. Your regexes simply tries to capture nothing.

Upvotes: 24

Related Questions