Skip to content

Extract Lines

Pull the lines you care about out of a log or export. Keep or drop lines matching a keyword or regular expression, or switch to extraction mode to harvest every email address, URL, or number in the text.

How Extract Lines works

  1. Paste a log file, CSV, or export.

  2. Enter a keyword or pattern and choose keep or exclude.

  3. Or switch to extraction mode for emails, URLs, or numbers.

  4. Copy the filtered lines.

When to use Extract Lines

  • Filtering a log so you keep only the lines that mention “ERROR” or a specific request ID, and drop the rest.
  • Stripping a repeating noise pattern out of an export by excluding every line that matches it.
  • Harvesting every email address out of a scraped page or a pasted contact dump, ignoring the surrounding text.
  • Pulling all the URLs, numbers, hashtags, or @-mentions out of a mixed block in one pass.
  • Isolating the lines of a CSV or config file that match a regular expression, with case sensitivity on or off.
  • Deduplicating the results of a filter or an extraction with a single switch, so a contact list comes out unique.

Examples

Extract email addresses

Input

Contact ada@example.com or the team at hello@neatkit.in today.
No address on this line.

Output

ada@example.com
hello@neatkit.in

Email mode scans the whole text, not line by line, so it finds both addresses on the first line and returns nothing from the second.

Keep only matching lines

Input

INFO started
ERROR disk full
INFO ready
ERROR timeout

Output

ERROR disk full
ERROR timeout

Filter mode with the keyword “ERROR” keeps the lines that contain it. Switching the direction to Exclude would return the two INFO lines instead.

A regex filter anchored to the start

Input

2024-01 opening balance
note: see appendix
2024-02 closing balance

Output

2024-01 opening balance
2024-02 closing balance

With Regular expression on and the pattern “^\d{4}-\d{2}”, only the lines that begin with a year-month stamp are kept; the free-text note is dropped.

How Extract Lines works under the hood

There are two distinct behaviours behind one panel. Filter mode is line-oriented: it walks each line and keeps or drops the whole line depending on whether your keyword or pattern matches. Extraction mode ignores line boundaries entirely — it scans the full text and pulls out every email, URL, number, hashtag, or mention it finds, returning one match per line, so several matches on the same source line become several output lines.

In filter mode a plain keyword is matched as a substring, case-insensitively unless you turn on Case sensitive. Turn on Regular expression to match a JavaScript pattern instead; the pattern is compiled with the case-insensitive flag off only when you ask for case sensitivity. The Exclude direction simply inverts the test, keeping every line that does not match — the quickest way to remove a recurring noise line from a log.

The extractors are pragmatic patterns tuned for real, messy input rather than for RFC completeness. Emails match an ordinary local part, an @, a domain, and a two-letter-or-longer top-level domain, deliberately skipping exotic but valid forms like quoted local parts because in scraped text those are almost always false positives. URLs match strings that start with http, https, or www and run until whitespace or a common closing character such as a quote, angle bracket, or bracket. Numbers match optionally signed digit runs that may include grouped decimals or thousands separators.

An invalid regular expression never crashes the tool: the error message is shown inline beneath the field and the output is left empty until the pattern compiles again. The Unique results switch collapses repeated matches — handy when the same address or value appears many times — while the sidebar reports how many lines matched out of the total source lines, so you can confirm the scope of a filter before you copy it.

Common mistakes

  • Expecting extraction to respect lines. Email, URL, number, hashtag, and mention modes scan the entire text and return one match per line of output, so two addresses on one source line become two result lines. Only filter mode is line-by-line.
  • Assuming email extraction catches every technically valid address. The pattern is deliberately conservative and skips exotic forms to avoid false positives; a normal address will always be caught, an unusual quoted one may not.
  • Treating a bare domain as a URL. The URL extractor needs an http, https, or www prefix — “example.com” on its own is not matched, by design, because bare domains are ambiguous in free text.
  • Forgetting that filter regexes are case-insensitive by default. If you need “Error” to differ from “error”, turn on Case sensitive; otherwise both match.

Frequently asked questions

All tools

Search NeatKit

Jump to a tool, a page, or change the theme.