Overview
Introduction
Scanning through pasted log output or a long list for lines that mention a specific term, or specifically excluding lines that do, is a common but tedious manual task.
This tool automates it.
What Is String Line Filter?
A line filter that keeps (or, with the invert option, discards) every line containing your search text, matched case-insensitively.
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 String Line Filter Works
The input is split into lines, and each line is tested for whether it contains the search text (lowercased for a case-insensitive comparison); matching lines are kept or discarded depending on the invert toggle.
The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.
When To Use String Line Filter
Use it to pull matching lines out of pasted log output, or to strip out lines matching an unwanted pattern.
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 Regex Match Extractor 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.
- Preserves both the order and the exact content of the lines it keeps, so filtered output can be diffed directly against the source.
Limitations
- Substring matching only, no regex support.
- Filters on a single search term at a time, so combining conditions means running the tool more than once.
Examples
Best Practices & Notes
Best Practices
- Use Extract Regex Matches instead if you need pattern-based rather than plain substring filtering.
- Chain runs to build a compound filter: keep the lines matching the first term, then filter that result by the next.
- Use the invert option to strip known noise, such as routine log lines, before searching what remains for the interesting cases.
Developer Notes
Matching lowercases both the line and the query before calling String.prototype.includes(), which is a simpler and faster approach than a case-insensitive regex for plain substring matching.
String Line Filter Use Cases
- Pulling error lines out of pasted log output
- Removing lines matching an unwanted keyword
- Quickly searching a pasted list for matching entries
Common Mistakes
- Expecting regex pattern support; matching is a plain substring search.
- Including surrounding whitespace in the search term, which stops it matching lines whose spacing differs even slightly.
Tips
- Use the invert toggle to quickly flip between 'show matches' and 'hide matches' without retyping the query.
- Because matching is a plain substring test, characters like . * and ? are searched for literally rather than treated as pattern syntax.