How to delete all lines containing a specific string in Notepad
Open Notepad and press Ctrl H to access Replace.In "Find what", enter ^.your_string.$\r?\n?, replacing your_string with target text.Leave "Replace with" empty, enable Regular expression mode, ensure ". matches newline" is off.Click Replace All to delete all lines containing the string, supporting both Windows and Unix line endings.

To delete all lines containing a specific string in Notepad , you can use the Find and Replace feature with regular expressions. This method is fast and efficient, especially for large files.
Open Find and Replace
Press Ctrl H to open the Replace tab in the Find dialog. Make sure you're on the "Replace" panel, not "Find".
Use Regular Expressions to Remove Lines
In the "Find what" field, enter:
^.*your_string.*$\r?\n?Replace your_string with the actual text you want to remove lines for. For example, if you want to delete lines containing "error", type:
^.*error.*$\r?\n?Leave the "Replace with" field empty.
At the bottom, select Search Mode as Regular expression, and make sure ". matches newline" is unchecked.
Execute the Replacement
Click Replace All. All lines containing the specified string will be removed.
Note: If your file uses Unix-style line endings (LF only), you might want to adjust the regex to handle that. The pattern \r?\n? covers both Windows (CRLF) and Unix (LF) line breaks.
Basically just match the whole line containing the string and replace it with nothing. It’s a clean way to filter out unwanted lines quickly.
The above is the detailed content of How to delete all lines containing a specific string in Notepad. For more information, please follow other related articles on the PHP Chinese website!
Hot AI Tools
Undress AI Tool
Undress images for free
AI Clothes Remover
Online AI tool for removing clothes from photos.
Undresser.AI Undress
AI-powered app for creating realistic nude photos
ArtGPT
AI image generator for creative art from text prompts.
Stock Market GPT
AI powered investment research for smarter decisions
Hot Article
Popular tool
Notepad++7.3.1
Easy-to-use and free code editor
SublimeText3 Chinese version
Chinese version, very easy to use
Zend Studio 13.0.1
Powerful PHP integrated development environment
Dreamweaver CS6
Visual web development tools
SublimeText3 Mac version
God-level code editing software (SublimeText3)
Hot Topics
20570
7
13669
4




