Filter Lines Online

Filter text lines by contains, starts with, ends with, length or regular expression. Keep matches or remove them, preserve order, and export the full result.

0 lines
Match

Filtered lines

Choose a rule and filter your lines.

Whole lines retain their original spelling, order and duplicates. Length counts Unicode code points, including spaces. Enter a JavaScript regular expression without / delimiters or flags; Ignore case controls case matching. Slow expressions are stopped automatically.

How to filter lines with a rule

  1. Choose the source and match rule

    Paste complete text lines or open a plain text file. Select Contains, Starts with, Ends with, Line length or Regular expression. Your original order, spelling and duplicate lines are retained. Begin with the simplest rule that describes the rows you actually need.

  2. Choose whether matches stay or go

    Enter a literal pattern or a minimum and maximum length. Ignore case changes case matching without rewriting the source. Keep matching lines by default; select Remove matching lines to keep the non-matches instead. Review the direction carefully when preparing an exclusion list.

  3. Run the filter and inspect the result

    Choose Filter lines after changing the input or any rule. Editing clears the previous result so it cannot be mistaken for a fresh one. Review the count and a few representative lines, then copy or export the complete result as TXT or CSV.

Example: keep a product-code prefix

An operations export may mix production product codes with test entries. A prefix rule makes that distinction explicit without editing each line. This example keeps every line starting with SKU-, including repeated matches; filtering is not deduplication.

Input lines

SKU-100
TEST-01
SKU-200
SKU-100

Rule

Starts with: SKU-
Keep matching lines
Ignore case: off

Filtered lines

SKU-100
SKU-200
SKU-100

Three lines remain because SKU-100 appears twice in the source. Enable Remove matching lines with the same prefix to get TEST-01 instead. If you want one copy of each remaining code, send the reviewed output through dedupe as a separate, deliberate step.

When this tool helps

Narrowing a copied log extract

Support teams can keep lines containing an error identifier or remove a known noisy prefix before reviewing a short log extract. Whole lines stay together, so timestamps and surrounding context on the same line survive. This does not parse structured logs, fetch remote systems or decide whether a repeated error represents one incident or several.

Separating filenames or identifiers

Use Ends with for an extension such as .csv, or Starts with for a consistent ID prefix. Ignore case can help when filename casing varies. Literal filters do not interpret wildcard characters: a dot remains a dot and an asterisk remains an asterisk. Use regular expressions only when the matching rule really requires them.

Checking line length and pattern constraints

Developers can identify values within a code-point length range or lines matching a JavaScript regular expression. Spaces contribute to length. An emoji sequence can contain several code points, so this is not a visual character or grapheme counter. Invalid lengths and malformed expressions produce errors rather than silently returning an apparently valid empty export.

Who this workflow is for

Analysts, developers, editors and support staff can use line filtering to build a focused review queue from data they already hold. It is especially useful when a spreadsheet’s full import workflow would be unnecessary. Decide what a matching line means before removing anything, retain the original export, and check a few rejected lines as well as the kept ones. Large input depends on browser memory; regex complexity can matter as much as file size.

Keep only the lines you need

Paste text or open a text file. Choose Contains, Starts with, Ends with, Line length or Regular expression. Enter a pattern or minimum and maximum lengths, then select Filter lines. Keep matches by default, or enable Remove matching lines to keep everything else. Change a rule and run the filter again to refresh the result.

Filter logs, identifiers and exports

Use Starts with to keep product codes from one category, Ends with to collect filenames with a particular extension, or Contains to find a phrase in copied log lines. Matching uses the whole original line as its input. Duplicate lines and their order remain intact. The tool does not trim whitespace or silently deduplicate results. Line length includes spaces and counts Unicode code points rather than visual grapheme clusters.

Use regular expressions deliberately

Enter a JavaScript regular expression without surrounding slashes or flags. Ignore case enables case-insensitive matching. Anchors such as ^ and $ apply to each line individually. Invalid syntax produces an error instead of an empty result. Expressions run in an isolated worker and stop after a short timeout if they are too expensive. Literal filters are a simpler option for large files.

Keep the work private

This tool runs in the browser tab you are using. No account is required and your text is not submitted to a server. The result exists only on this device, so copy or download it before closing the page.

Frequently asked questions

What is the difference between Contains and Starts with?

Contains matches the literal pattern anywhere within a line. Starts with only matches at the beginning, and Ends with only at the end. These rules preserve spaces, so a leading space can prevent a prefix match. They do not trim the input automatically.

How do I remove matching lines?

Enable Remove matching lines and run the filter. The selected rule then describes the lines to exclude. For example, Contains with TEST removes lines containing that exact text, or any case variation when Ignore case is enabled. The original source box is not rewritten.

Do duplicate lines remain in the output?

Yes. Every matching occurrence remains in its original position relative to the other kept lines. Filtering selects lines; deduplication groups values. Use the separate dedupe tool afterward if you want one copy of each result, and choose its matching rules independently.

How is line length measured?

Length counts Unicode code points, including spaces. The minimum and maximum are inclusive whole numbers, with zero allowed. A joined emoji or combining sequence can use several code points while looking like one character. This mode does not measure rendered width or UTF-8 byte length.

How should I enter a regular expression?

Enter a JavaScript expression without surrounding / delimiters or flags. Ignore case controls case-insensitive matching, and ^ and $ refer to each line separately. Invalid brackets or escapes are reported. Literal patterns are easier to review when you only need a prefix, suffix or substring.

Why was my regular expression stopped?

Expressions run in an isolated worker with a short timeout so a pathological pattern cannot freeze the page. A timeout means the expression was too expensive for that run, not that no lines match. Simplify the expression, reduce the input or choose a literal filter.

Can I keep blank lines?

Yes. A zero-length range or a suitable expression can match empty lines. A retained final blank line is represented in TXT output with a line ending, while CSV contains an explicitly quoted empty field. One trailing source line ending is treated as a delimiter rather than an additional line.

Does CSV output preserve a multi-column input table?

No. Each complete input line is one value, even if it contains commas. CSV download creates one escaped item column from the selected lines. If you need cell-aware selection from a workbook, use Excel comparison or prepare the desired single column before filtering.

Related tools