Filter Lines - Remove or Keep Lines Containing Text

Keep or remove lines from any list. Pick a filter type, type a word if needed, and instantly split your list into matched and unmatched lines.

Input
Type or Drag & Drop a file
Mode:
WHERE
Kept
Removed

Frequently Asked Questions

How do I keep only lines that contain a specific word?
Select Contains from the dropdown, type your word in the text box, and the Kept panel shows all matching lines instantly. Switch to Remove matching to do the opposite: remove every line containing that word and keep the rest.
How do I remove all blank lines from a list?
Select Is blank from the dropdown and set the mode to Remove matching. All blank or whitespace-only lines move to the Removed panel and the Kept panel shows your clean list.
How do I keep only lines that look like email addresses?
Select Looks like an email from the Data type group - no typing needed. Lines that match the standard email pattern (user@domain.com) appear in the Kept panel automatically. Useful for extracting email addresses from a mixed list of names, IDs, and emails.
What is the difference between Contains and Is exactly?
Contains matches any line that has your text anywhere inside it. Is exactly only matches lines identical to your text - not longer, not shorter, not with extra spaces. Example: searching for "apple" - Contains matches "apple", "pineapple", and "apple pie". Is exactly matches only "apple".
Is the filter case-sensitive?
Not by default. "Error" matches "error", "ERROR", and "Error" equally. Enable the Case sensitive checkbox when you need exact capitalisation matching - for example, filtering Python keywords (must be lowercase) or SQL keywords (typically uppercase).
How do I filter lines by their length?
Select Longer than or Shorter than and enter a character count. For example, Shorter than 3 removes lines like "yes", "no", "ok" while keeping longer entries. Longer than 0 removes all blank lines. Useful for removing header rows, short noise entries, or lines truncated during export.
Can I filter by multiple conditions at once?
Yes - click Add condition to stack up to 8 conditions. Each new row has an AND / OR toggle that controls how it chains with the previous row. Conditions are evaluated left-to-right in the order they appear, with no AND-before-OR precedence. For example: Contains "error" AND Longer than 50 keeps only lines that both contain "error" and are longer than 50 characters. Switching the second condition to OR would keep lines that match either rule.
What is the difference between AND and OR conditions?
AND narrows your results - a line must satisfy both the previous condition and the new one to be kept. OR widens your results - a line satisfying either condition is kept. You can mix them freely: Contains "apple" AND Starts with "green" OR Contains "banana" processes left to right, so it means (apple AND green-start) OR banana. Use AND to zero in on a specific subset; use OR to combine multiple include rules into one pass.
What does the regex option do and do I need it?
Regex (regular expression) lets you match complex patterns - for example, "lines that start with a digit" (^\d) or "lines that end with .com" (\.com$). For most common filters, the other match types cover what you need without any syntax knowledge. The regex option is there for users who already know regex and need a pattern the built-in types cannot express. An invalid regex causes no error - lines simply won't match. To replace text within lines rather than filter whole lines out, use the Find & Replace tool.

Related reading

Share this tool

Featured on ToolDirs
© 2026 ListDiff

Free online list and text processing tools.