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.
- Rejoins the survivors with a single space, so the filtered result reads as continuous prose rather than a fragmented list.
Limitations
- Sentence detection is a simple punctuation-based heuristic, so it can mis-split on abbreviations like 'Dr.' or decimal numbers.
- Discards the original paragraph structure, since surviving sentences are joined into one block regardless of where they came from.
Examples
Best Practices & Notes
Best Practices
- Use Word Filter instead if you need to keep individual words rather than whole sentences.
- Use the Paragraph Filter instead when surrounding context matters, because a sentence pulled out on its own can read misleadingly.
- Search for a distinctive word rather than a common one, since a keyword appearing in most sentences filters almost nothing out.
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.
- Filtering a transcript containing timestamps or abbreviations, where the decimal points and full stops split sentences in unexpected places.
Tips
- Use the invert toggle to quickly flip between 'show matches' and 'hide matches' without retyping the keyword.
- Invert the filter to see everything the keyword did not match, which is often the fastest way to confirm nothing relevant was missed.