简体   繁体   English

如何匹配Notepad ++中的整行以进行搜索/替换?

[英]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: 我想在Notepad ++中对文件进行批量逐行替换,如下所示:

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" + 查找: ^$替换: "\\1" +

Find: ^()$ Replace: "\\1" + 查找: ^()$替换: "\\1" +

Find: (^$) Replace: "\\1" + 查找: (^$)替换: "\\1" +

Any hints? 任何提示? Thanks in advance! 提前致谢!

Try to search for ^(.*)$ and replace with "\\1" + 尝试搜索^(.*)$并替换为"\\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. 你的正则表达式只是试图捕获任何东西。

Try this: 试试这个:

Find: ^(.*?)$

Replace: "\1" +

This should work: 这应该工作:

Find (.*) replace "\\1" + 查找(.*)替换"\\1" +

Try this and see if it works for you: 试试这个,看看它是否适合你:

Find: ^(.+)$ Replace: "\\1" + 查找:^(。+)$替换:“\\ 1”+

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM