Notepad++ Regular expression find and delete a line

后端 未结 5 1382
梦如初夏
梦如初夏 2021-01-30 10:21

I am trying to find and delete a line using Notepad++

I need to find lines in this file (UNIX Format) that match the string \'#RedirectMatch Permanent

相关标签:
5条回答
  • 2021-01-30 10:58

    Combining the best from all the answers

    0 讨论(0)
  • 2021-01-30 11:01

    If it supports standard regex...

    find:
    ^.*#RedirectMatch Permanent.*$
    
    replace:
    

    Replace with nothing.

    0 讨论(0)
  • 2021-01-30 11:02

    Step 1

    • SearchFind → (goto Tab) Mark
    • Find what: ^Session.*$
    • Enable the checkbox Bookmark line
    • Enable the checkbox Regular expression (under Search Mode)
    • Click Mark All (this will find the regex and highlights all the lines and bookmark them)

    Step 2

    • SearchBookmarkRemove Bookmarked Lines
    0 讨论(0)
  • 2021-01-30 11:03

    Provide the following in the search dialog:

    Find What: ^$\r\n
    Replace With: (Leave it empty)

    Click Replace All

    0 讨论(0)
  • 2021-01-30 11:12

    Using the "Replace all" functionality, you can delete a line directly by ending your pattern with:

    • If your file have linux (LF) line ending : $\n?
    • If your file have windows (CRLF) line ending : $(\r\n)?

    For instance, in your case :

    .*#RedirectMatch Permanent.*$\n?
    
    0 讨论(0)
提交回复
热议问题