Filter Lines

Keep or drop lines that contain a string or match a regular expression.

What Filter Lines helps you do

Keep or drop lines that contain a string or match a regular expression. It is the fast way to extract the relevant lines from a large paste, such as log entries or a subset of a list. The filter is line-based: a match keeps or removes the whole line, not just the matching text.

Filtering runs locally in your browser with no upload to Haivix.

How it works

Line tools split the pasted text into lines, apply one operation to the list, and rejoin it with a newline. A blank line is still a line, so it participates in sorting, numbering and shuffling unless you remove it first. The transformation runs in the browser and keeps the existing line order except where the tool's purpose is to change it. Nothing is uploaded, and the output replaces the preview rather than the source. If the input ends with a newline, the final empty line can affect a count or a shuffle; trim the input first when that matters.

How to use Filter Lines

  1. Paste the text you want to filter.
  2. Enter a search string or regular expression and choose keep or remove.
  3. Apply the filter and check the count of remaining lines.
  4. Copy the remaining lines.

When to use it

  • Extract only the error lines from a log excerpt.
  • Reduce a list to entries that match a keyword.
  • Remove comment lines or noise before further processing.
  • Keep rows that mention a specific account or ID.
  • Remove blank or placeholder lines from a paste.
  • Extract lines that match a date or status pattern.

When not to use it

  • Do not use it to select part of a line; it keeps or drops whole lines.
  • Do not use a broad pattern without checking the count.
  • Do not expect CSV-aware matching; quoting is not considered.

Example

Keeping only lines containing error from a mixed log leaves just the matching entries. Removing lines that match DEBUG does the opposite. An empty query matches every line, so the filter does nothing until a query is entered.

What you can do with Filter Lines

  • Keep only lines that match a query.
  • Remove lines that match a query.
  • Match by plain substring or regular expression.
  • Ignore case by default.
  • Leave the remaining lines in their original order.
  • Copy the filtered result.

Example: check the line structure first

Paste a small sample and note how many lines it has, including blank lines and a possible trailing newline. The count explains most surprises after sorting, numbering or filtering.

Apply the operation and compare the first and last lines with the source. If the structure is right, run the full text; if not, remove the blank lines or trim the input first.

Copy or download the result and keep the original until the destination accepts it. Line tools are one-way, so the source is the only undo.

For a list pasted from a spreadsheet, check for hidden carriage returns or wrapping quotes before transforming it. A stray quote can sort differently or survive a filter that looks correct at a glance.

When the result feeds another tool, run a second pass only after confirming the first. Chaining a sort and a deduplication is safe, but chaining two numbering steps produces duplicated prefixes.

If the output is going into a version-controlled file, check the diff before committing. A blank-line or line-ending change can look like a content change in review even when the words are unchanged.

What to know before you start

  • Filtering is line-based, so it cannot select parts of a line.
  • A malformed regular expression does not match and can leave the list unchanged.
  • It does not understand CSV quotes or multi-line records.
  • There is no preview count before applying the filter.

Common mistakes

  • Using a broad pattern and keeping more lines than intended.
  • Forgetting that matching is case-insensitive by default.
  • Expecting a regex to select a substring rather than the whole line.
  • Leaving the query empty and assuming the list will be cleared.

Troubleshooting

If no lines remain, the query matches nothing or the keep/remove choice is inverted.

If too many lines remain, the pattern is broader than intended; test it on a small sample.

If a regex pattern is rejected, check the syntax and escape special characters.

If the line count looks wrong, blank lines may be matching an empty or wildcard pattern.

Related standards and documentation

  • A newline is a single line separator in Unix text; Windows files may use CRLF.
  • Modern JavaScript sorts are stable, so equal lines keep their relative order.
  • Blank lines are entries, not separators, in these transformations.
  • A trailing newline is a text convention, not content; remove it before counting lines.
Blank lines are still lines
  • Count the lines before you transform.
  • Remove blanks first when they should not participate.
  • Keep the original until the result is accepted.
  • Check the last line for a trailing newline.

Frequently Asked Questions