Regex Extract

List every match of a regular expression, one per line, like grep -o in your browser.

Text
Matches
Runs locally in your browser

About the Regex Extract

When you want the matches themselves rather than the text with them highlighted, this tool lists them one per line. The pattern is applied globally, and with no capture groups each whole match becomes a line. Add groups and only the group values are written, separated by tabs, so (\d{4})-(\d{2})-(\d{2}) produces three spreadsheet columns instead of one date string. Matches appear in the order they occur, repeats included. It is the browser equivalent of grep -o with the convenience of instant feedback.

Watch for patterns that are able to match nothing at all. \d*, or a group in which every part is optional, matches the empty string at every position, which fills the result with blank lines and pushes the count into the thousands. Requiring at least one character with +, or anchoring the pattern, fixes it.

A typical job is pulling every order reference out of a support mailbox export with ORD-\d{6}, then tidying the result with Remove Duplicate Lines before pasting it into a query. For the most common targets there are dedicated extractors that need no pattern at all, emails, URLs and numbers; this tool handles everything else.

How to use

  1. Paste the text.
  2. Enter the pattern; add groups to split each match into columns.
  3. Copy the list, one match per line.

Common questions

What if my pattern has groups?
Each match line contains the group values separated by tabs, so it pastes as columns.
Are duplicates removed?
No, every match is listed. Use Remove Duplicate Lines afterwards if needed.
Is the whole match listed when there are no groups?
Yes.