Extract RegExp Matches from Text

Enter a pattern and extract every match instantly.

Options

Quick patterns

0 = full match, 1+ = capture group.

Type \n for a new line, \t for a tab.

Matching
The result updates as you type. Ctrl + Enter extracts now.

Matches

How to extract regex matches

Paste your text into Your text, or press Load example. Type a JavaScript regular expression into Pattern — or press an Email, URL or Number quick pattern — and every match appears in the result box, one per line. Copy the result or download it as matches.txt. Everything runs in your browser, so nothing you paste is uploaded.

Quick patterns

PresetPatternFinds
Email [A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,} ada@example.com
URL https?://[^\s"')>]+ https://example.com/a
Number -?\d+(?:\.\d+)? 42, -3.14

Examples

InputOutput
Pattern (\w+)@(\w+), group 2 on ada@example.com example
Pattern https?://[^\s"')>]+ on Visit https://example.com https://example.com
Pattern -?\d+(?:\.\d+)? on Call 555-1234 555 -1234

Limits and edge cases

  • Patterns use the JavaScript RegExp flavor: unbalanced brackets or parentheses show an error.
  • Group 0 returns the full match; groups 1 to 99 return that capture group, or an empty string when the group did not take part in a match.
  • Zero-length matches (for example from x*) are collected one per position, so the search always finishes.
  • Multiline makes ^ and $ match at line starts and ends; without it they match only at the ends of the whole text. Dot-all lets . match across line breaks.

Frequently asked questions

How do I extract regex matches from text?

Paste your text, type a JavaScript regular expression into the pattern box, and every match appears in the result box. Copy it or download it as matches.txt.

What pattern finds email addresses?

The default pattern finds email addresses. Press the Email preset at any time to restore it, or use the URL and Number presets for links and numeric values.

How do I extract a capture group instead of the full match?

Wrap part of the pattern in parentheses and set Group to its number, starting at 1. Group 0 always returns the full match.

Why do I see an invalid regular expression error?

The pattern is compiled as a JavaScript RegExp, so unbalanced brackets or parentheses fail. Fix the syntax and the matches update live.

What do the flag checkboxes do?

Ignore case matches upper and lower case alike, Multiline makes ^ and $ match at line starts and ends, and Dot-all lets . match across line breaks.

Is my text uploaded anywhere?

No. Matching runs in your browser with JavaScript and nothing is sent to a server. Inputs under 200 KB are kept in your browser's local storage so they are still there when you come back.