List Filter

Keeps only items matching a condition (starts with, ends with, contains, regex, or minimum length) in a separator-delimited list, with an invert option to keep everything that does NOT match instead. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

Filtering a list down to only the items that satisfy a condition, like a prefix, suffix, or minimum length, is a common cleanup and analysis task.

List Filter offers five match conditions and a configurable separator, plus an invert option, so one tool covers most "keep only" and "keep everything except" scenarios for delimited lists.

What Is List Filter?

A general-purpose conditional filter for delimited lists: choose a condition (starts with, ends with, contains, regex, or minimum length) and List Filter keeps only the items satisfying it.

The invert toggle flips the logic to keep only items that fail the condition instead, without needing a second tool.

How List Filter Works

The input is split into items using the selected separator, then each item is tested against the chosen condition and its pattern (or minimum length value).

Items passing the test are kept (or, with invert on, items failing the test are kept instead), and the surviving items are rejoined using the selected separator.

When To Use List Filter

Use it to keep only items starting or ending with a particular prefix or suffix, like filenames sharing an extension or IDs sharing a prefix.

It's also useful for length-based cleanup, for example stripping out overly short placeholder entries from a dataset.

Features

Advantages

  • Five distinct match conditions cover most common filtering needs in one tool.
  • The invert toggle avoids needing to write a negated regex or a second pass.
  • Works on any configurable separator, unlike newline-only line filters.

Limitations

  • Regex mode uses default JavaScript regex flags; build in case-insensitivity yourself if needed.
  • Only one condition can be applied at a time; combining multiple conditions requires chaining the tool's output back into itself.

Examples

Starts With filter

Input

apple
banana
apricot (startsWith: "ap")

Output

apple
apricot

Only items beginning with "ap" are kept.

Minimum Length filter with invert

Input

a,bb,ccc (comma separator, minLength: 2, invert on)

Output

a

With invert on, only items shorter than the 2-character minimum are kept, the opposite of the normal minimum-length behavior.

Best Practices & Notes

Best Practices

  • Use the invert toggle instead of trying to write a negated regex pattern, it's simpler and less error-prone.
  • Chain multiple List Filter passes together (feed the output back in as input) to apply more than one condition.

Developer Notes

Each condition maps to a small predicate (`String.prototype.startsWith`, `.endsWith`, `.includes`, a compiled `RegExp.test`, or a `.length` comparison), applied via `Array.prototype.filter()` with the predicate's result optionally negated when `invert` is true.

List Filter Use Cases

  • Keeping only filenames with a specific extension pasted from a directory listing
  • Filtering a list of IDs down to those sharing a known prefix
  • Removing overly short or placeholder entries by minimum length

Common Mistakes

  • Forgetting the invert toggle exists and manually trying to write a negated regex pattern instead.
  • Expecting Minimum Length to trim whitespace before measuring; it measures the raw item length exactly as split.

Tips

  • If you need newline-only filtering with a simple contains/invert toggle, String Line Filter is a lighter-weight option for that specific case.
  • Combine Contains mode with invert to quickly strip out every item mentioning an unwanted term.

References

Frequently Asked Questions