TT Text Tools

Filter Lines — Keep or Remove Lines Containing Text

Keep or remove lines that contain a word, start or end with text, or match a regular expression. Filter logs and lists in your browser.

🔒 Runs entirely in your browser — nothing is uploaded

Advertisement

Keep or remove lines that match

When you need the error lines from a long log, the rows of an export that mention one customer, or a word list without the entries that contain digits, a line filter does the job in seconds. Paste your text, type what you are looking for, and choose whether to keep the matching lines or delete them. The result and a count of kept and removed lines update as you type.

Five match types cover most needs. "Contain" finds the text anywhere in the line. "Start with" and "end with" anchor it to the beginning or the end, which is ideal for prefixes such as dates or log levels and for file extensions. "Exactly equal" matches whole lines only. "Match regex" lets you write a JavaScript regular expression for complex rules, such as ^\d{4}-\d{2} for lines that begin with a date or @(gmail|outlook)\.com$ for certain email domains.

Multiple terms and case sensitivity

Tick "Several terms" to filter by a list of words at once — enter one per line and a line matches if any of them match. That makes it easy to keep only lines mentioning a set of product codes or to remove lines containing any word from a blocklist. Matching ignores upper and lower case by default; tick "Case sensitive" when capitalisation matters, for example to separate ERROR from error.

Removing matches is the inverse operation: switch to "Remove matching lines" to drop comments that start with #, delete debug messages, or clean blank lines with the regular expression ^\s*$. Lines always keep their original order, and nothing else in them is changed.

Private log filtering

Logs and exports often contain IP addresses, emails and internal identifiers. Filtering runs entirely in your browser, so nothing is uploaded and you can safely work with sensitive data.

How to use

  1. Paste your textAdd a log file, list, CSV export or any text with one record per line.
  2. Choose keep or removeKeep only the matching lines, or remove them and keep the rest.
  3. Set the matchMatch lines that contain, start with, end with or exactly equal your text, or use a regular expression.
  4. Copy the filtered linesThe counter shows how many lines were kept and removed.

Frequently asked questions

How do I keep only lines containing a word?
Leave "Keep matching lines" selected, choose "contain" and type the word. Matching is case-insensitive unless you tick "Case sensitive".
Can I filter by several words at once?
Yes. Tick "Several terms" and enter one term per line. A line matches when any of the terms match.
Which regular expression syntax is supported?
JavaScript regular expressions with Unicode support, for example ^\d{4}- for lines starting with a year or (ERROR|WARN) for either word. Invalid patterns show an error message instead of a result.
Does it change the order of lines?
No. Lines that pass the filter stay in their original order.
Advertisement