Remove Lines Containing Text
Delete every line that contains a substring or matches a regex.
Text to match
Input Text
Result Output
Kept lines: 0Removed lines: 0
How Remove Lines Containing Text works
Paste any block of text and enter a substring — every line that contains it gets deleted, line by line, in your browser. Turn on regular expression to match patterns instead of plain text (for example ^\s*// to strip comment lines), and toggle case insensitiveso "TODO" and "todo" are treated the same. Flip invert to flip the logic and keep only the lines that match instead of removing them — handy for extracting just the error lines from a log or just the rows containing a keyword from a CSV export. Nothing is uploaded; filtering happens entirely on your device.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Filtering a log down to the lines that do not mention a noisy component.
- Removing commented lines from a config file.
- Dropping rows that match a pattern before importing a list.
- Keeping only the lines that match, using invert mode.
- Cleaning a list of entries that share an unwanted marker.
Frequently Asked Questions
- What does the tool operate on — lines or matches?
- Whole lines. A line containing the search term anywhere in it is removed entirely, which is what makes it useful for stripping debug statements or TODO comments from a paste. Removing just the matched substring is a find-and-replace job, not this one.
- Can I keep the matching lines instead of removing them?
- Yes — the inverse mode keeps only lines that match, which is the equivalent of `grep` rather than `grep -v`. The same query answers both questions, and flipping the mode is usually faster than rewriting the term to match everything else.
- Is the match case-sensitive?
- It is an option, and the default matters more than it looks. `todo` with case sensitivity on misses `TODO`, which is how the majority of them are actually written — so a case-insensitive sweep is usually the one that catches what you meant.
- Can I use a regular expression?
- Where regex mode is enabled, yes, and it is what you need for anything positional — `^\s*//` for a comment only at the start of a line, or `\bTODO\b` to avoid matching a word that merely contains those letters. A plain substring search cannot express either.
- What happens to blank lines?
- They are left alone unless your term matches them, which an empty term technically would. If the goal is to tidy the result afterwards, that is a separate step — this tool decides which lines go, not how the survivors are spaced.
Common errors and gotchas
- Matching a substring when a whole word was meant, so 'cat' also removes 'category'.
- Forgetting case sensitivity, which silently leaves half the matches behind.
- Using an unescaped regex metacharacter, so the pattern matches far more than intended.
- Removing a line that carried context for the lines around it.
- Inverting the match by accident and deleting everything you wanted to keep.
Related Text Tools tools
Case Converter
Convert between Sentence, Title, camelCase, snake_case, and more.
Word Counter
Count words, characters, and analyze keyword density.
Text to Binary
Convert text into its 8-bit binary representation.
Binary to Text
Decode 8-bit binary back into readable text.
Text Reverser
Reverse text by characters, words, or lines.
Remove Duplicate Lines
Delete repeated lines and keep your list unique.
Remove Empty Lines
Strip blank and whitespace-only lines from text.
Sort Lines Alphabetically
Sort lines A–Z or Z–A, case-sensitive or not.