How to Filter a List by Text, Pattern, or Length

You've got a list and you need only some of it - the lines containing a keyword, the ones that look like email addresses, everything except the blank lines, or anything over a certain length. Doing this by hand means scrolling and manually deleting rows one at a time. A filter tool does it in one pass.

Quick answer

To filter a list of lines, paste it into a filter tool and choose a match type - Contains, Is exactly, Starts with, a data-type preset like email or URL, or a length condition - then choose whether to keep or remove matching lines. Multiple conditions can be chained with AND/OR for more precise filtering, no regex required.

Filter your list now

Open Filter Lines →

Match types

  • Contains - matches a line with your text anywhere inside it.
  • Is exactly - matches only lines identical to your text, no more and no less.
  • Starts with / Ends with - matches based on the beginning or end of the line.
  • Data type presets - "Looks like an email," a URL, or other common patterns, without typing anything.
  • Is blank - matches empty or whitespace-only lines, useful for cleanup.
  • Longer than / Shorter than - matches by character count instead of content.

Every match type works in two directions: Keep matching puts matching lines in the Kept panel, and Remove matching does the reverse - matching lines get removed and everything else stays.

Chaining conditions with AND / OR

Click Add condition to stack up to 8 rules. Each one has an AND/OR toggle controlling how it combines with the row before it, evaluated left to right:

  • AND narrows the result - a line has to satisfy both conditions to be kept.
  • OR widens the result - a line matching either condition is kept.

Example: Contains "error" AND Longer than 50 keeps only lines that both mention "error" and run long. Change that AND to OR and it keeps any line that does either.

When you need real regex

The built-in match types cover most filtering without any special syntax. For patterns they can't express - "lines starting with a digit," "lines ending in .com" - a raw regex option is available for anyone who already knows it. An invalid pattern simply matches nothing rather than throwing an error, so it's safe to experiment.

Need to change text within lines, not filter them out?

Find & Replace edits the content of each line instead of keeping or removing whole lines.

Try Find & Replace →

Frequently Asked Questions

How do I keep only lines that contain a specific word?
Select Contains in Filter Lines, type the word, and the Kept panel updates instantly with every matching line. Switch to Remove matching to do the reverse - remove every line with that word and keep the rest.
How do I extract email addresses from a list of mixed text?
Select Looks like an email from the Data Type presets - no typing needed. Every line matching a standard email pattern goes to the Kept panel automatically, whether it's mixed in with names, IDs, or other text.
How do I remove all blank lines from a list?
Select Is blank and set the mode to Remove matching. Every blank or whitespace-only line moves out, leaving a clean list in the Kept panel.
How do I filter lines by length?
Select Longer than or Shorter than and enter a character count. Shorter than 3 removes short noise entries like "ok" or "no"; Longer than 0 removes every blank line.
What's the difference between Contains and Is exactly?
Contains matches a line with your text anywhere inside it - searching "apple" matches "apple", "pineapple", and "apple pie". Is exactly only matches a line identical to your text, nothing more or less.
Can I combine more than one filter condition?
Yes - stack up to 8 conditions with an AND/OR toggle between each. "Contains error AND Longer than 50" keeps only lines that satisfy both. Switching that AND to OR would keep lines matching either rule instead.
Is this basically grep for people who don't use a terminal?
That's a fair way to describe it. It covers the filtering grep is most commonly used for - keep/remove by text, pattern, or length - through dropdowns and checkboxes instead of command-line flags and regex syntax. A raw regex option is also available for anyone who wants it.
How do I replace text within lines instead of filtering whole lines out?
Filter Lines only keeps or removes entire lines - it doesn't edit what's inside them. For that, use the Find & Replace tool instead.

Share this tool

Featured on ToolDirs
© 2026 ListDiff

Free online list and text processing tools.