Filter Lines — Online Grep to Keep or Remove Matching Lines
Keep or remove lines matching a substring or regex pattern. Invert match, case-insensitive, trim before match.
How to use
- 1 Paste lines on the left and a pattern below.
- 2 Toggle Keep matching (default) or Remove matching.
- 3 Switch on Regex for full regular expression power, with i / m / u / s flag toggles.
- 4 Copy the filtered result.
Why use this tool
- Plain substring match by default — no regex special-character traps.
- Regex mode with the four most-used JS flags exposed as checkboxes.
- Invert match flips just the match, leaving Keep/Remove logic intact.
- Bad regex shows inline, never crashes the page.
Frequently asked questions
What is the difference between Invert match and switching Keep/Remove?
They are equivalent — "Remove matching X" is the same as "Keep + Invert match on X". The two controls just make common phrasings ("keep lines that do NOT contain", "remove lines that do NOT contain") quick to express.
What do the regex flags do?
i = case-insensitive, m = multiline (^ and $ match each line), u = full Unicode, s = dot matches newline. We always run per-line so m has limited effect here; useful when your pattern itself spans newline-escaped sequences.
How does Trim before match interact?
The line is trimmed only for the match decision; output lines keep their original leading/trailing whitespace.
Related tools?
Use Deduplicate Lines to drop duplicates, or Sort Lines to reorder after filtering.
What is Filter Lines?
A Filter Lines tool is a tool that keeps or removes lines of text matching a substring or regular expression pattern. It supports inverting the match, case-insensitive comparison, and trimming each line before matching. Running entirely in the browser, it works like an online grep for filtering text, letting users find and remove lines containing specific content without sending data to a server.
Features
Keep or remove matches
Show only matching lines, or drop them, with an invert toggle.
Substring or regex
Match a plain substring or a full regular expression with i / m / u / s flags.
100% private
Runs on your device — your text is never uploaded.
Example
Input
apple
banana
apricot (keep lines containing "ap")
Output
apple
apricot
Common use cases
-
1
Grep pasted text
Filter a log or list down to the lines containing a term or pattern.
-
2
Remove unwanted lines
Drop comment lines, blanks, or entries matching a pattern.
-
3
Extract structured rows
Keep only lines matching a regex (e.g. emails, IPs) from mixed text.
Zerethon's filter-lines tool keeps or removes lines that match a substring or regular expression, in your browser. It supports regex flags (i, m, u, s), an invert option, and trim-before-match — ideal for grepping through pasted text. Everything runs client-side; nothing is uploaded.
- Category
- Creator
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
References
Privacy
Your data never leaves your browser unless explicitly stated. Filter Lines runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
YouTube Thumbnail Downloader
Download YouTube thumbnails in all available resolutions. Just paste a video URL.
Open toolOpen Graph Preview
Test how your URL appears when shared on social media. Preview Facebook, Twitter, LinkedIn, and Slack cards.
Open toolWord & Character Counter
Count words, characters, sentences, and paragraphs. Reading time, speaking time, and top keywords — instant.
Open toolLorem Ipsum Generator
Generate Lorem Ipsum placeholder text — by paragraphs, sentences, or words. Optional HTML wrapping.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.