Filter Lines (Keep or Remove Lines Containing)
grep in your browser: keep or drop lines by words, regex or length.
Or drop a text file on the box. Nothing leaves your device.
Filter
Each line is one term. Spaces count.
Characters as you see them: an emoji counts as one.
About the Filter Lines (Keep or Remove Lines Containing)
Paste a list, a log file or any text and pick the lines you want: keep (or remove) the lines that contain a word, start with it, end with it or are exactly it — or that match a regular expression, or that are longer or shorter than a number of characters. Type several terms, one per line, and choose whether a line must match any of them or all of them.
The result shows the kept lines and the removed lines side by side with their counts, so you can check at a glance that nothing important went missing, and copy or download either list. It works like grep (and grep -v) on the command line, but needs no install and keeps your text on your device.
How to use it
- Paste your text, or use Open file (or drop a .txt, .csv or .log file onto the box).
- Choose Keep or Remove and what to look for: contains, starts with, ends with, is exactly, matches regex, or a line length.
- Type your terms, one per line, and choose Any term or All terms. Turn Ignore case and Whole words only on or off.
- Read the counts, then Copy or Download the kept lines — or the removed ones.
Examples
09:14:02 INFO Server started 09:14:05 WARN Disk usage at 81% 09:15:11 ERROR Payment API timeout 09:17:03 INFO Health check OK
09:14:05 WARN Disk usage at 81% 09:15:11 ERROR Payment API timeout
ORD-104522 note: call back ORD-104523 ORD-10452
ORD-104522 ORD-104523
ORD-10452 has only five digits, so the anchored pattern rejects it.
Every line of more than 160 characters, emoji counted as one character each.
Common uses
- Pulling errors, a user ID or an order number out of a server or application log.
- Removing unsubscribed, bounced or internal addresses from a mailing list before an import.
- Keeping only the URLs of one domain or folder from a sitemap or crawl export.
- Finding lines that are too long for a subtitle, an SMS or a database column.
How the matching works
- Contains, starts with, ends with and is exactly compare plain text: a dot is a dot and a bracket is a bracket. Ignore case uses full Unicode case folding, so
STRASSEfindsStraße, and an accented letter typed in either of its two Unicode forms matches the other. - Whole words only (for contains) needs a non-letter, non-digit character or the line edge on both sides:
catfinds “the cat sat” and “cat-like”, not “category” or “bobcat”. - Ignore spaces at line ends lets starts with, ends with, is exactly and the length filters look past indentation and trailing spaces — and a stray space at that end of a term is ignored too. The lines you get back are never changed.
- Any term / All terms: with several terms, Any keeps a line that matches at least one; All needs every one of them (for example, lines that contain both “invoice” and “overdue”).
- Line length counts the characters you see — an emoji or an accented letter counts once, even when it is stored as several code points.
Regular expressions
Each line of the terms box is one JavaScript regular expression, tested against each whole line: ^ and $ mean the start and end of the line, \d a digit, \b a word boundary, (a|b) either. Matching runs in a background worker with a 3-second limit, so a pattern that would take forever (catastrophic backtracking, such as (a+)+$) is stopped instead of freezing the page. To try a pattern on sample text first, use the Regex Tester.
Command-line equivalents
Keep · contains is grep -F, Remove is grep -v, Ignore case is -i, Whole words only is -w, matches regex is grep -E (with JavaScript syntax), and Add original line numbers is -n.
Limitations
- Lines are filtered one at a time; a term never matches across a line break.
- Regular expressions use JavaScript syntax. Lookbehind, named groups and Unicode property escapes such as
\p{L}work in current browsers; POSIX classes such as[[:digit:]]do not. - Whole-word matching treats letters, digits and the underscore as word characters; it does not know about compound words in languages written without spaces.
- Files up to 50 MB can be opened; very large results are previewed in part, while Copy and Download always include everything.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.
Frequently asked questions
How do I remove all lines that contain a word?
Choose Remove and contains, then type the word in the terms box. To remove lines that contain any of several words, put each word on its own line and keep Any term selected.
How do I keep only the lines that contain two words?
Put both words in the terms box, one per line, and choose All terms. Only lines that contain every term are kept.
Why did a line with my word not match?
Check Ignore case (on by default), and whether Whole words only is on — then “email” does not match “emails”. With contains, spaces in the terms box count: a term with a space at its end only matches where that space is too.
Can I see what was removed?
Yes. The removed lines are shown next to the kept lines, with their own count, Copy and Download buttons. Tick Add original line numbers to see where each line came from.
Are blank lines kept?
A blank line contains no text, so it is removed when you keep lines with a term and stays when you remove lines with a term. To strip blank lines on their own, use shorter than 1 character with Remove.
Is my text uploaded?
No. Filtering happens in your browser (regular expressions in a background worker on your own device); nothing you paste or open is sent anywhere.