Find and extract all pattern matches from text

Extract every non-overlapping match and its capture groups from text.

freeworks offlinenothing uploaded
ToolRegex Extract
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The expression runs once or globally, and full matches plus numbered or named captures become structured rows. Global mode returns each non-overlapping match; first-match mode returns only the earliest one.

  • Global extraction suits lists of IDs and links.
  • First-match mode is useful for one header or field.

Worked example

Extract email addresses from text
Extract all email addresses from a block of text
Input
											Contact [email protected] or [email protected] for help
										
Output
												Contact
john
example
com
or
jane
example
com
for
help
											

When to use this

Document search, log parsing, and migration scripts extract repeated fields.

Edge cases

  • Overlapping matches are not returned by ordinary global matching.
  • An optional capture can be undefined in one row.
  • A zero-length match must advance to prevent an infinite loop.

References