Keep only the lines you need
Paste text or open a text file. Choose Contains, Starts with, Ends with, Line length or Regular expression. Enter a pattern or minimum and maximum lengths, then select Filter lines. Keep matches by default, or enable Remove matching lines to keep everything else. Change a rule and run the filter again to refresh the result.
Filter logs, identifiers and exports
Use Starts with to keep product codes from one category, Ends with to collect filenames with a particular extension, or Contains to find a phrase in copied log lines. Matching uses the whole original line as its input. Duplicate lines and their order remain intact. The tool does not trim whitespace or silently deduplicate results. Line length includes spaces and counts Unicode code points rather than visual grapheme clusters.
Use regular expressions deliberately
Enter a JavaScript regular expression without surrounding slashes or flags. Ignore case enables case-insensitive matching. Anchors such as ^ and $ apply to each line individually. Invalid syntax produces an error instead of an empty result. Expressions run in an isolated worker and stop after a short timeout if they are too expensive. Literal filters are a simpler option for large files.
Keep the work private
This tool runs in the browser tab you are using. No account is required and your text is not submitted to a server. The result exists only on this device, so copy or download it before closing the page.
Frequently asked questions
What is the difference between Contains and Starts with?
Contains matches the literal pattern anywhere within a line. Starts with only matches at the beginning, and Ends with only at the end. These rules preserve spaces, so a leading space can prevent a prefix match. They do not trim the input automatically.
How do I remove matching lines?
Enable Remove matching lines and run the filter. The selected rule then describes the lines to exclude. For example, Contains with TEST removes lines containing that exact text, or any case variation when Ignore case is enabled. The original source box is not rewritten.
Do duplicate lines remain in the output?
Yes. Every matching occurrence remains in its original position relative to the other kept lines. Filtering selects lines; deduplication groups values. Use the separate dedupe tool afterward if you want one copy of each result, and choose its matching rules independently.
How is line length measured?
Length counts Unicode code points, including spaces. The minimum and maximum are inclusive whole numbers, with zero allowed. A joined emoji or combining sequence can use several code points while looking like one character. This mode does not measure rendered width or UTF-8 byte length.
How should I enter a regular expression?
Enter a JavaScript expression without surrounding / delimiters or flags. Ignore case controls case-insensitive matching, and ^ and $ refer to each line separately. Invalid brackets or escapes are reported. Literal patterns are easier to review when you only need a prefix, suffix or substring.
Why was my regular expression stopped?
Expressions run in an isolated worker with a short timeout so a pathological pattern cannot freeze the page. A timeout means the expression was too expensive for that run, not that no lines match. Simplify the expression, reduce the input or choose a literal filter.
Can I keep blank lines?
Yes. A zero-length range or a suitable expression can match empty lines. A retained final blank line is represented in TXT output with a line ending, while CSV contains an explicitly quoted empty field. One trailing source line ending is treated as a delimiter rather than an additional line.
Does CSV output preserve a multi-column input table?
No. Each complete input line is one value, even if it contains commas. CSV download creates one escaped item column from the selected lines. If you need cell-aware selection from a workbook, use Excel comparison or prepare the desired single column before filtering.