Skip to content

Line Filter

Paste a list, a transcript, a log or a data file, enter the words or patterns you care about, and keep only the lines that contain them — or delete those lines and keep the rest. You choose case, whole-word and start-or-end matching, or switch to regular expressions, and the tool counts the lines and matches it found. It runs in your browser and nothing is uploaded.

Runs entirely in your browser. Your text and any file you open are never uploaded.

What to do with matching lines
Terms are

Spaces at the start or end of a term are ignored. A term can contain commas.

Paste some text and enter at least one term to filter it.

How to Use the Line Filter

  1. Paste or open your text. Every line break starts a new line. A final line break is not counted as an extra empty line, and Windows (CRLF) line endings are kept in the output.
  2. Enter your terms, one per line. Each line of the term box is one word, phrase or pattern. Choose Plain text for ordinary words and phrases, or Regular expressions for patterns.
  3. Choose Keep or Remove. Keep returns only the matching lines. Remove deletes them and returns the rest. With several terms, a line matches when it has any one of them or all of them, whichever you pick.
  4. Set the matching rules, then check the counts. The counts show how many lines and how many individual matches there were, with a row for each term and a preview of the first matching lines. Copy the result or download it as a .txt file.

Matching Options

OptionWhat it doesExample with the term support
Match caseOff by default; capitals and lowercase are treated as the same letterOff finds Support and support; on finds only support
Whole words onlyThe match may not touch a letter, digit or underscore on either sideFinds support but not supported or unsupported
Starts with / ends with / is exactlyAnchors the term to the start, the end, or the whole of the lineStarts with finds Support is… but not We support…
Ignore spaces at the ends of a lineOn by default; leading and trailing spaces and tabs do not count, but the output keeps themLets is exactly match support
Always keep empty linesEmpty lines pass through whatever the filter saysKeeps paragraph gaps when you use Keep

Worked Example

Choose Load a sample: six lines of an interview, one of them empty, and the term support. With the defaults (keep, any case, no whole-word rule), three lines match and there are four matches in all: supported in the first, support twice in the fourth, and unsupported in the fifth. Switching on Whole words only leaves one line and two matches, because supported and unsupported no longer count. Choosing Remove instead returns the empty line, the interviewer's line and the last line, three of six.

Using Regular Expressions

In regular-expression mode each term is a JavaScript pattern tested against one line at a time, so ^ means the start of a line and $ its end. It is the ECMAScript flavour, close to what grep -E accepts but not identical: \d, \w, \b, lookahead and lookbehind work, while inline flags such as (?i) and possessive quantifiers do not. Case-insensitive matching is controlled by the Match case box, not by a flag.

PatternFinds
^Participant \d+:Lines that begin with a participant label such as Participant 12:
\b\d{1,2}:\d{2}\bLines containing a clock time such as 9:30 or 14:05
^\s*$Lines that are empty or hold only spaces
\b(?:um|uh|er)\bLines with a filler word as a whole word
^\s*[-*•] Lines that start with a bullet
\p{Lu}{4,}Lines with a run of four or more capital letters, in any alphabet

Slow patterns

A repeated group inside a repeated group, such as (a+)+, can take exponential time on some lines and freeze a browser tab. The tool refuses patterns of that shape and tells you which term to rewrite. This is a safeguard, not a guarantee: other patterns can still be slow on very long lines.

Frequently Asked Questions

How do I remove all lines that contain a certain word?
Paste your text, type the word in the term box, and choose Remove. The result is every line that does not contain the word. Tick Whole words only if you do not want support to remove lines containing supported.
How do I keep only the lines that contain several words?
Enter one word per line in the term box and set a line to match when it has all of them. A line is then kept only if every term appears in it, in any order. Choose any one of them instead to keep a line that has at least one of the words.
What is the difference between this and Find and Replace?
Find and Replace changes text inside lines; this tool decides which whole lines to keep. To delete a word from every line, use Find and Replace with an empty replacement. To drop every line that contains the word, use this tool.
Is this the same as grep?
Keep is like grep, Remove is like grep -v, Match case off is like grep -i, and Whole words only is like grep -w, which also treats letters, digits and underscores as word characters. The regular-expression flavour is JavaScript's, so a few grep patterns need small changes.
Why does my regular expression say it is invalid?
The message names the term and the browser's own reason, such as an unclosed bracket or a quantifier with nothing to repeat. While any term is invalid the text is left unfiltered, so you never get a half-filtered result. A literal bracket, dot, plus sign or question mark needs a backslash in front of it, or use plain-text mode, which escapes them for you.
How many lines can it handle?
Tens of thousands of lines are fine for plain-text terms, because the work happens in your browser and is limited by its memory. Complex patterns on very long lines are slower. Nothing is uploaded or stored.

Related Tools

More in Text Cleanup & Formatting

See all Text Cleanup & Formatting