Filter Lines: Keep or Remove Matching Text Rows

Keep the relevant lines without changing their contents

Filter Lines selects whole rows from a small text list. Use a literal word for simple inclusion or exclusion, or a JavaScript regular expression when a row must match a more specific structure. The result preserves source order, duplicate rows and the original whitespace within retained lines.

A worked example: review warnings in a short log

Paste these invented entries into Input list:

INFO start
WARN retry
ERROR stop
INFO done
  1. Enter warn as Search text or regex. With the default case-insensitive comparison and Keep matching lines, the result is WARN retry: one of four lines retained.
  2. Change the action to Remove matching lines. The result contains INFO start, ERROR stop and INFO done, in that order.
  3. Turn on Regular expression and enter ^(WARN|ERROR)\b without slash delimiters. Return to Keep matching lines. This keeps WARN retry and ERROR stop.
  4. Add a line such as INFO previous WARN to test the anchor. It is excluded because WARN is not at the start of that row.
  5. Copy or download the result as filtered_lines.txt after checking the retained-line count. Download and copy use the current completed result.

Filtering removes entire nonmatching or matching lines, depending on the action. It does not extract just the matched word or replace part of a line; use the Regex Tester when you need to inspect captures or preview a substitution.

Literal matching, anchors and whitespace

Plain-text mode treats punctuation literally. Case sensitive distinguishes WARN from warn. Match start of line uses a prefix comparison; Match end of line uses a suffix comparison. Enabling both requires the whole compared line to equal the query.

For input cat catfish wildcat cat cat, query cat with both anchor controls enabled keeps the first and last cat rows. Enable Trim lines before matching and it also keeps the row with spaces around cat. Those spaces remain in the output: trimming changes which lines match, rather than rewriting them. Duplicate rows are retained.

An empty query returns all lines in either action. Empty input has zero lines. A trailing line break adds an empty final row, so a\n represents two rows. CRLF, LF and CR line endings are accepted, and copied or downloaded output uses LF line endings.

Regex mode and blank lines

Regex mode uses the browser's JavaScript RegExp engine, applied separately to each line. Case sensitive controls whether the i flag is used. Enter ^\s*$ to identify blank or whitespace-only lines, then choose Remove matching lines to discard them. To keep rows with at least ten UTF-16 characters, try ^.{10,}$; this counts code units rather than user-perceived letters.

The plain-text start/end controls are hidden in regex mode. Put anchors in the expression itself. A pattern such as /warn/i is not parsed as a slash-delimited expression here: the slashes become literal pattern characters. Patterns written for another regex flavor may behave differently or be rejected.

A retained empty row can have an empty-text result; the count distinguishes it from zero retained rows. If you are surprised by the count, check trailing line breaks and whether whitespace was trimmed for matching. This page does not deduplicate lists, parse quoted CSV fields, sanitize confidential data or determine which log entries are important.

Limits, errors and recovery

The input is limited to 100,000 UTF-16 characters and 1,000 lines; the query is limited to 2,000 characters. Both literal and regex filtering run in a separate browser worker. A test stops after 1.5 seconds, including worker startup. Reduce the sample or simplify nested regex groups after a timeout; it means the test did not finish, not that its syntax is necessarily invalid.

Oversized pastes are rejected before insertion, leaving your current input intact. Edit the input or use Reset filter to clear a rejected-paste message. Syntax errors, excessive input and worker failures hide the old result and disable copying/downloading. Changes cancel the preceding calculation, so a previous result cannot be mistaken for the current query. Reset filter clears both fields and restores the default Keep action and switch settings.

Processing and privacy

This filtering feature processes your list and query within a browser worker without a SimplyUtils filtering API. It does not save a filtering history; reloading clears the inputs. The site can still load advertising and analytics services, and extensions have their own access. Use redacted or invented data. A copied result enters the clipboard, and a downloaded file remains wherever your browser saves it.

For the language behavior used by the tool, see MDN's JavaScript RegExp.test reference.

Check a result before replacing a source list

Use a small invented fixture to establish what the selected action means. For an inventory review, place crate-42 ready, crate-43 hold and crate-44 ready on separate lines. Keep matching lines with ready should retain the first and third entries in that order. Remove matching lines should retain only crate-43 hold. Download the result and compare its actual line breaks and text before using the same settings on an important list. Keep a source copy: this tool selects lines but does not understand which records are operationally safe to delete.

Interpret boundaries and privacy precisely

An empty result is valid when nothing matches; it is different from a regex error or a timed-out worker. A trailing line break creates an additional empty line, so compare the status count with the input's actual structure. Trimming affects comparison while retained content keeps its original spacing. The worker's time limit protects the interface from some expensive expressions but is not a proof that an arbitrary regex is safe in another application. Processing is local; downloading creates another copy and copying can place list contents in clipboard history. Use synthetic records when reporting an unexpected match and state every enabled switch.

Guide published by . View our publishing information and contact details.