Sentence Filter

Keeps only the sentences that contain your keyword (case-insensitive), or with the invert option, keeps only the sentences that don't, rejoining the survivors with spaces. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-23

Overview

Introduction

Scanning a long paragraph or article for the sentences that mention a specific topic, or specifically excluding sentences that do, is tedious to do by eye.

This tool automates it with a single keyword and an invert toggle.

What Is Sentence Filter?

A sentence filter that keeps (or, with the invert option, discards) every sentence containing your keyword, matched case-insensitively, and rejoins the result with single spaces.

It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.

How Sentence Filter Works

The input is split into sentences using punctuation boundaries, and each sentence is tested for whether it contains the keyword (lowercased for a case-insensitive comparison); matching sentences are kept or discarded depending on the invert toggle, then rejoined with spaces.

The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.

When To Use Sentence Filter

Use it to pull every sentence mentioning a topic out of a long article, or to strip out sentences matching an unwanted pattern before further editing.

It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.

Often used alongside String Line Filter and Text Sorter.

Features

Advantages

  • Case-insensitive by default, matching common expectations for quick text search.
  • Invert option covers both 'keep matches' and 'remove matches' use cases.

Limitations

  • Sentence detection is a simple punctuation-based heuristic, so it can mis-split on abbreviations like 'Dr.' or decimal numbers.

Examples

Keeping sentences containing 'server'

Input

The app crashed. The server restarted itself. Users noticed nothing.

Output

The server restarted itself.

Only the sentence containing 'server' is kept; the others are dropped.

Best Practices & Notes

Best Practices

  • Use Word Filter instead if you need to keep individual words rather than whole sentences.

Developer Notes

Sentences are split with `/[^.!?]*[.!?]+(?=\s|$)|[^.!?]+$/g`, the same heuristic used elsewhere in this site's sentence-based tools, then matched with a lowercased `String.prototype.includes()` check.

Sentence Filter Use Cases

  • Pulling every sentence mentioning a topic out of an article
  • Removing sentences matching an unwanted keyword before publishing
  • Quickly scanning a pasted document for relevant sentences

Common Mistakes

  • Expecting perfect sentence detection around abbreviations or decimal numbers; the split is a simple heuristic.

Tips

  • Use the invert toggle to quickly flip between 'show matches' and 'hide matches' without retyping the keyword.

References

Frequently Asked Questions