EditSafely

Extract Regex Matches from a String

Pull every substring that matches a regular expression.

Runs on your device, nothing uploaded

Regular expression
Output
All groups puts a tab between the groups of each match.
Try:

0 chars · 0 lines

Output

Pull every substring that matches a regular expression.

Type or paste above to see the result here.

Example: Extract all numbers

What you paste never leaves this tab

Extract Regex Matches from a String is JavaScript that your browser has already downloaded, and it does the whole job on your own machine. On a normal site, the text you paste is sent to a server that can log it, cache it or keep it. Here it is read and transformed inside this tab and nowhere else.

  • No upload
  • No length limit
  • Works offline once loaded
  • Nothing stored or logged

How to use Extract Regex Matches from a String

  1. 1. Paste the text to search. Enter the block of text you want searched into the input pane, from a single line to a full document.
  2. 2. Enter the regular expression. Type the pattern in the bar above the text or tap a chip such as Numbers, Emails or Hashtags; matches are tinted as you type. Output picks the whole match, the first ( ) group or all groups, and More options holds the m, s and u flags.
  3. 3. Copy the matched substrings. Copy the list of every substring that matched the pattern, one per line, and use it wherever the extracted matches are needed.

When to use Extract Regex Matches from a String

Extract Regex Matches from a String pulls every substring in a block of text that matches a regular expression you provide. It is the general-purpose version of extraction when a specific data type like emails or numbers isn't already built in.

  • Pulling hashtags out of social media posts. You have a batch of exported posts and want every hashtag, matched with a pattern like '#\w+', pulled into its own list for a content analysis.
  • Extracting IP addresses from a log file. A server log mixes IP addresses with timestamps and messages, and a regex pattern targeting the IP format extracts just the addresses for further review.
  • Grabbing quoted strings from source code. You want every double-quoted string literal pulled out of a code file for a quick audit of hardcoded values, using a pattern that matches quoted text.
  • Testing a regular expression against sample text. You are writing a regex for use elsewhere and want to verify it captures exactly the substrings you expect from realistic sample text before deploying it.

Examples

Extract all numbers

Input

order 42, item 7

Output

42
7

First number of each range

Input

pages 10-12 and 40-45

Output

10
40

Hashtags

Input

Loving the #sunset and #beach today

Output

#sunset
#beach

About the Extract Regex Matches from a String tool

Extract Regex Matches from a String is a free online tool that works entirely inside your web browser. Pull every substring that matches a regular expression. Because the processing happens on your own device, nothing you enter is uploaded, logged or stored anywhere.

This page is one of 159 String utilities on EditSafely. Each one does a single job well, and all of them follow the same rule: your input stays on your machine.

You can shape the output with 7 settings, including Regular expression, Ignore case, Output and ^ and $ match at every line (m), and the result refreshes the moment you change one. 3 worked examples further down the page show exactly what the tool produces for real inputs.

Because nothing leaves your device, the tool is suitable for sensitive content such as internal documents, credentials or customer data. It also responds instantly, since every step is handled on your own machine rather than by a remote API.

Frequently asked questions

Does Extract Regex Matches from a String cost anything?

Yes, it is completely free. All 2,943 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.

How much text can I process at once?

There is no fixed limit; your device's memory is the ceiling. Up to 10 MB the result updates as you type, after a short pause that grows with the size. Above 10 MB a Run button appears so typing stays smooth, and files open up to 50 MB. A very long result shows its first 2,000 lines on screen, while Copy and Download always include all of it.

Do I need to sign up or install anything?

Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.