[英]Notepad++ Regular expression find and delete a line
I am trying to find and delete a line using Notepad++我正在尝试使用 Notepad++ 查找和删除一行
I need to find lines in this file (UNIX Format) that match the string '
#RedirectMatch Permanent '
and delete that line.我需要在此文件(UNIX 格式)中找到与字符串
'
#RedirectMatch Permanent '
匹配的行并删除该行。
Does anyone know how to do this using Notepad++ Find and Replace?有谁知道如何使用 Notepad++ 查找和替换来执行此操作?
Thanks and Kind Regards,感谢和亲切的问候,
Step 1步骤1
Search
→ Find
→ (goto Tab) Mark
Search
→ Find
→ (goto Tab) Mark
Find what
: ^Session.*$ Find what
:^Session.*$Bookmark line
Bookmark line
Regular expression
(under Search Mode
)Regular expression
(在Search Mode
)Mark All
(this will find the regex and highlights all the lines and bookmark them)Mark All
(这将找到正则表达式并突出显示所有行并将它们添加为书签) Step 2第2步
Search
→ Bookmark
→ Remove Bookmarked Lines
Search
→ Bookmark
→ Remove Bookmarked Lines
If it supports standard regex...如果它支持标准正则表达式...
find:
^.*#RedirectMatch Permanent.*$
replace:
Replace with nothing.什么都不换。
Provide the following in the search dialog:在搜索对话框中提供以下内容:
Find What: ^$\r\n
查找内容:
^$\r\n
Replace With: (Leave it empty)替换为:(留空)
Click Replace All单击全部替换
Using the "Replace all" functionality, you can delete a line directly by ending your pattern with :使用“全部替换”功能,您可以通过以以下方式结束您的模式来直接删除一行:
$\n?
$\n?
$(\r\n)?
$(\r\n)?
For instance, in your case:例如,在您的情况下:
.*#RedirectMatch Permanent.*$\n?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.