Grep for Pasted Text (Context Lines, Invert, Regex)

Runs a grep-style search on text you paste, with context lines, invert, whole-word matching and a count.

Use the tool

Why this tool exists

Sometimes you only need to find the interesting lines in a log or export without opening a terminal. This tool offers the grep options people use most: -n line numbers, -v invert, -i ignore case, -w whole word, -A and -B context, -c count and -o matching parts only.

The output format follows GNU grep, so match lines use a colon and context lines use a dash, with -- between groups. The pattern is a JavaScript regular expression, which differs a little from POSIX or PCRE, for example in how \b and character classes work.

How to use it

  1. Paste your text.
  2. Enter a pattern and tick regex if it is an expression.
  3. Choose options such as invert, whole word or context lines.
  4. Copy the filtered lines.

Frequently asked questions

Is this the same as GNU grep?

The output layout and options match. The pattern syntax is JavaScript regex, not POSIX basic or extended expressions.

How is the plain pattern treated?

Special characters are escaped, so a dot means a dot and not any character.

What does only the matching parts do?

It prints each match on its own line, like grep -o. It cannot be combined with invert.

Is the text uploaded?

No. Everything runs in your browser.