Extract RegExp Matches
Find and extract all substrings that match a specific Regular Expression pattern.
Regex Pattern
Quick Reference
\d - Any digit (0-9)\w - Word character (a-z, 0-9, _)\s - Whitespace. - Any character* - 0 or more+ - 1 or more? - 0 or 1{2,5} - 2 to 5 timesTry These
[\w.-]+@[\w.-]+\.\w+-?\d+\.?\d*https?://[^\s]+Use the g flag to find all matches, not just the first one!
Find Patterns with Regex
The Extract RegExp Matches tool is a playground for your Regular Expressions. Instead of just testing if a match exists, we extract every single occurrence into a clean list. Perfect for scraping data like emails, phone numbers, or SKUs from large text blobs.
How to Use
- Select a preset or enter your custom regex pattern
- Toggle flags - Enable global (g), case-insensitive (i), or multiline (m)
- Paste or upload your text
- Review matches - All extracted values appear instantly
- Download or copy - Export as TXT, CSV, or JSON
Common Use Cases
Data Extraction
Extract emails, phone numbers, or product codes from unstructured documents. Export to CSV for spreadsheet analysis.
Pattern Testing
Test regex patterns before implementing in code. See all matches instantly to verify your pattern works correctly.
Log File Analysis
Parse log files to extract error codes, timestamps, or IP addresses. Upload large .log files directly.
Common Patterns
Emails
[\w.-]+@[\w.-]+\.\w+Find all email addresses in a document.
Dates (YYYY-MM-DD)
\d4-\d2-\d2Extract standard ISO dates.
How it works
- Compile: We create a
new RegExp()from your pattern and flags. - Execute: We run the matcher against your text.
- List: Every match found is collected and displayed as a new line.
Example
#456
Frequently Asked Questions
Which Regex flavor does this use?
This tool uses JavaScript's native RegExp engine. It supports standard JS regex syntax, including lookaheads, capture groups, Unicode flags, and all ES6+ features. The extracted matches are compatible with Node.js and browser environments.
Why do I need the 'g' flag?
The 'g' (global) flag tells the engine to keep searching after the first match. Without it, the tool will only return the very first instance found. For extracting all email addresses or URLs from a document, the 'g' flag is essential.
Can I upload files to extract patterns?
Yes! Click the Upload button in the Input Text header to load .txt, .md, or .log files. The tool will parse the entire file and extract all matches. Perfect for processing log files, data dumps, or large documents.
How do I extract all email addresses from text?
Use the preset 'Email Addresses' from the dropdown, or manually enter the pattern: [\w.-]+@[\w.-]+.\w+ with the 'gi' flags. The 'g' extracts all emails, and 'i' makes it case-insensitive.
What's the difference between Total and Unique matches?
Total Matches shows every occurrence (e.g., 'test' appears 5 times = 5 total). Unique Matches counts distinct values (e.g., 'test', 'demo', 'test' = 2 unique). This helps identify duplicates in extracted data.
Can I download the extracted matches?
Yes! Download as TXT (newline-separated list), CSV (table with Index, Match, Length columns for Excel), or JSON (complete data with pattern, flags, statistics, and matches array).
How do the preset patterns work?
The preset dropdown contains 10 common patterns (emails, URLs, phone numbers, dates, hex colors, IPv4, hashtags, numbers, words, credit cards). Clicking a preset automatically fills the pattern and sets the correct flags.
What does the 'i' flag do?
The 'i' flag makes the pattern case-insensitive. For example, pattern 'hello' with 'gi' flags will match 'hello', 'Hello', 'HELLO', and 'HeLLo'. Essential for text searches where case doesn't matter.
Can I extract phone numbers from documents?
Yes! Use the 'Phone Numbers (US)' preset which matches formats like (123) 456-7890, 123-456-7890, or 123.456.7890. For international numbers, you'll need a custom pattern matching your country's format.
Is this useful for data scraping?
Absolutely! Extract structured data from unstructured text: emails from contact pages, dates from logs, product codes from invoices, or hashtags from social media dumps. The CSV export makes it easy to import into spreadsheets for analysis.