Text Filter
Filter a block of text line by line. Keep only lines that match your keywords, or drop lines that do. Plain string matching, multi-pattern with comma separation, or full regex. Best for log files, list cleanup, and any line-based filtering job.
How to filter lines of text
1. Paste the lines
Drop the line-oriented text you want to filter into the input box. Log files, lists, CSV rows, command-line output, exported chat history - any text where the meaningful unit is a line works.
2. Pick an action
Include matching lines keeps only lines that match your pattern. Exclude matching lines drops the matching lines and keeps the rest.
3. Pick a match mode
Contains is plain substring match: the line matches if your pattern appears anywhere in it. Exact line requires the whole line to equal the pattern exactly. Regex treats your pattern as a JavaScript regular expression for advanced matching.
4. Enter your pattern
Type a keyword in the pattern box, or comma-separate multiple patterns (e.g. ERROR, WARN, FATAL). With multiple patterns, a line matches if it matches any one of them.
5. Tune options and apply
Toggle Case-sensitive, Drop duplicates, Trim whitespace, Skip blank lines. The output updates live; click Copy or Download .txt when you have what you want.
When you need a line filter
A line filter pays for itself in any workflow where you have a big block of text and only some lines are interesting.
Log file triage
Paste a log dump, filter for ERROR, and you have the error subset ready to ticket. Switch to Exclude with DEBUG, TRACE to keep everything that is not noise.
List cleanup
A 5000-line export has rows you do not want (duplicates, headers, test data). Filter them out with a pattern that targets the noise.
URL or email list filtering
Filter a URL list to keep only those containing https://wordcounter.ai. Filter an email list to drop the @ from a specific domain. Useful as a precursor to outreach or audit.
Code search
Paste a file's contents, regex-filter for function signatures (^function\s+) or imports (^import\s+) to extract structure.
Chat or comment moderation
Filter exported chat for lines containing a keyword (or excluding banned terms) before pasting into a report.
Plain text vs regex matching
Contains (default)
The simplest mode. Your pattern is matched as a literal substring. ERROR matches any line that contains the letters ERROR anywhere. Case-sensitive by default toggle off.
Exact line
The whole line must equal the pattern exactly. Useful when you have an allow-list of specific values and want to keep only those. With multiple patterns, the line matches if it equals any of them.
Regex
JavaScript regular expression syntax. Common patterns:
^ERRORmatches lines that START with ERROR\d{4}-\d{2}-\d{2}matches lines with a YYYY-MM-DD date\w+@\w+\.\w+matches lines containing an email address(ERROR|FATAL|WARN)matches any of three log levels
Invalid regex patterns are silently ignored (the matcher treats them as never-match), so a typo will produce an empty output rather than an error.
Multi-pattern filtering with commas
Type more than one pattern in the pattern box, separated by commas, to match any of them. The matcher is OR-based.
Example: pattern ERROR, WARN in Contains mode + Include action keeps every line that contains either ERROR or WARN. To get AND behavior (lines that contain BOTH), apply the filter twice: first for ERROR, then on the result for WARN.
Multi-pattern works for regex mode too. ^ERROR, ^FATAL in regex mode includes lines starting with either ERROR or FATAL. You can also use regex alternation in a single pattern: ^(ERROR|FATAL).
Dedup, trim, and blank-line handling
Drop duplicate lines
After filtering, repeated lines are collapsed to one. Useful when an input has the same line many times (a log that repeats the same error). Dedup runs after the filter, so two ERROR lines collapse to one only if they are byte-identical (trimming applies first if Trim is on). See also: Remove Whitespace.
Trim whitespace
Strips leading and trailing whitespace from each line before matching and before output. Affects both the match (so ERROR with leading spaces still matches ERROR) and the deduplication (so two ERROR lines that differ only by indentation collapse).
Skip blank lines
Removes lines that are entirely whitespace (or empty after trimming). Removed before the filter, so blank lines do not count toward the matched or dropped totals.
Common filtering patterns by use case
| Goal | Mode | Pattern |
|---|---|---|
| Keep ERROR lines | Contains / Include | ERROR |
| Drop DEBUG lines | Contains / Exclude | DEBUG |
| Keep lines starting with date | Regex / Include | ^\d{4}-\d{2}-\d{2} |
| Keep email-containing lines | Regex / Include | \w+@\w+\.\w+ |
| Exclude blank or header lines | Exact / Exclude | (empty), Name, ID |
| Keep https URLs only | Contains / Include | https:// |
Related tools
Frequently asked questions
What is the difference between Contains and Exact line?
Contains matches if the pattern appears anywhere in the line. Exact line matches only if the whole line equals the pattern. Use Contains for partial-match (the usual case). Use Exact line when you have a list of complete known values and want to keep or drop only those.
Can I use regex to filter?
Yes. Switch the match mode to Regex and type a JavaScript regular expression in the pattern box. Common patterns: ^ERROR (starts with ERROR), \d{4} (contains a 4-digit number), (foo|bar) (contains either word). Invalid regex is silently treated as never-match.
How do I combine multiple patterns?
Comma-separate them in the pattern box: ERROR, WARN, FATAL matches any line containing ERROR or WARN or FATAL. The combiner is OR. For AND behavior (lines containing all of multiple patterns), apply the filter twice in sequence.
Is the matching case-sensitive?
Not by default. ERROR, error, and Error all match the same pattern. Turn on Case-sensitive in the sidebar if you need exact-case matching (which matters for some log formats and case-sensitive identifiers).
Does the text leave my browser?
No. The filter runs entirely in your browser using JavaScript. Your input, the pattern, and the filtered output are never sent to our servers and are not logged.
What if my pattern contains a comma?
Commas in the pattern box are always treated as separators, so a comma inside the pattern itself breaks the match. Workaround: use regex mode and escape the comma if needed (commas have no special meaning in regex, so just type it as-is). For exact-line matching of a string with a comma, use regex mode with anchor: ^that, exact, value$.
Why is my Match count higher than my Output count?
Because dedup runs after the filter. If 5 lines match and 2 of them are duplicates, the matched count is 5 but the output count is 3. To see the matched count without dedup, turn Drop duplicates off.
Is there a limit on input size?
No hard cap. The filter handles inputs of several megabytes. Line-by-line processing is O(n), so even very large logs filter in well under a second.
More wordcounter.ai tools
Other tools you might find useful.