All Over Tools logo
Tool Combiner
Analyze Tools Clean Tools Compare Tools Convert Tools Data Validation Extract Tools Format Tools Generate Tools Organize Tools Transform Tools
Audio Tools Font Tools Image Tools Subtitle Tools Video Tools
Archive Tools Document Tools Ebook Tools File Management Tools PDF Tools Presentation Tools
Config Tools Database Tools Dataset Tools JSON Tools Parser Tools Spreadsheet Tools XML Tools
Business Calculators Construction Calculators Date And Time Calculators Education Calculators Financial Calculators Food Calculators Health Calculators Math Calculators Science Calculators Sports Calculators Statistics Calculators
Blog About Us Contact Us

Extract Lines Containing a String

Filter your text and keep only the lines that contain a specific word, phrase, or pattern.

How to extract lines containing a string

Paste text into Input text or use Upload, then enter a word, phrase, or regular-expression pattern in Search. The tool checks each line and places selected lines in Matching lines output. You can then review the result, select Copy, or select Download.

How to filter text lines by keyword

  1. Paste text into Input text, or select Upload to add a text file.
  2. Enter the word or phrase in Search.
  3. Select Case sensitive when letter case should affect the match.
  4. Select Use regex for a regular-expression pattern. Select Invert (exclude matching lines) to keep lines that do not match.
  5. Review Matching lines output, then select Copy or Download.

What Search and regex matching change

Search uses literal text when Use regex is clear. The match runs on each line, and Case sensitive controls letter case. With Case sensitive clear, ERROR matches Error. With it selected, those values differ.

Use regex treats Search as a JavaScript regular expression. The tool creates it with no flag when Case sensitive is selected, or with the case-insensitive i flag when it is clear. An invalid pattern displays Enter a valid regular expression. and keeps Matching lines output hidden.

2026-10-16 INFO Backup started
2026-10-16 ERROR Disk full
2026-10-16 INFO Backup finished

Set Search to ERROR to keep the middle line.

2026-10-16 ERROR Disk full

Select Invert (exclude matching lines) with the same Search value to keep the two INFO lines. The output retains the line endings attached to the selected source lines.

Extract matching lines from a log file

Paste a server log and search for timeout to isolate complete matching entries for copying. You can also upload a Markdown or CSV text file and keep rows containing a project code.

Matching lines output appears only after Input text and Search both contain text. A blank Search value clears the result. If no line matches, Copy and Download stay disabled.

When another text extractor fits better

Use Text Parsing & Data Extraction when you need a different kind of text result. Choose Custom Regex Extractor for matching fragments or capture groups instead of whole lines. Choose Keyword List Extractor for several keywords and occurrence counts. Choose Extract Emails from Text when the target is email addresses rather than complete lines.

Frequently asked questions

How do I extract lines containing a word?

Paste the text into Input text, enter the word in Search, and read the matching lines in Matching lines output. The tool checks the value against each line.

Can I filter lines with a regular expression?

Yes. Select Use regex and enter the pattern in Search. The pattern uses JavaScript regular-expression construction, with case sensitivity controlled by Case sensitive.

How do I exclude lines that contain a string?

Select Invert (exclude matching lines) after entering the value in Search. Lines that match Search are removed, and the other source lines are kept.

Does extracted line text keep its original line breaks?

Yes. Selected lines retain the line-ending text attached to them in Input text. The tool recognizes CRLF, LF, and CR line separators.

Related Tools

82 views