Regex Tester
Test regular expressions live with real-time match highlighting and capture group details.
2 matches
· 2 uniqueMatches
| # | Index | Full Match | Group 1 | Group 2 |
|---|---|---|---|---|
| 1 | 25 | alice@example.com | alice | example.com |
| 2 | 46 | bob@company.org | bob | company.org |
Test regular expressions as you type
This regex tester runs your pattern against sample text and highlights every match instantly. It uses your browser's JavaScript regular expression engine, so results match what new RegExp() does in JavaScript. Syntax from other languages (PCRE, Python) may behave differently.
How to use it
- Type a pattern between the slashes — no need to escape the slashes yourself.
- Toggle flags: g (global), i (case-insensitive), m (multiline) and s (dotAll).
- Paste your test string. Matches are highlighted and counted, with the number of unique matches.
- Check the match table for each match's position (index), full text and capture groups. The first 20 matches are listed.
- Click Copy /{pattern}/flags to copy it as a regex literal.
If the pattern is invalid, the browser's error message is shown under the input. Presets are included for email, URL, IPv4, phone, MM/DD/YYYY date, hex colour, HTML tags, JWT, UUID, credit-card-style numbers and Markdown bold and links.
Worked example
Pattern (\w+)@(\w+\.\w+) on Email me at alice@example.com or bob@company.org gives 2 matches:
| # | Full match | Group 1 | Group 2 |
|---|---|---|---|
| 1 | alice@example.com | alice | example.com |
| 2 | bob@company.org | bob | company.org |
Quick regex cheat sheet
\ddigit,\wletter/digit/underscore,\swhitespace,.any character.+one or more,*zero or more,?optional,{2,4}2 to 4 times.^and$start and end (of each line with the m flag).( )capture group,(?: )group without capturing,[abc]any one of a, b or c.
Frequently asked questions
Does the g flag change the results here?
The tester always finds every match so you can see them all. The g flag is still included in the copied pattern, where it matters in your code.
Are the presets perfect validators?
No. They are practical starting points — for example, the IPv4 preset also accepts 999.1.1.1. Test them against your own data.
Related Developer Tools
Browse all tools from the same category.
Domain Authority Checker
Check Moz authority, page authority, spam score, and backlink metrics
Open toolSEO Audit Tool
Audit a website URL for technical SEO, metadata, headings, broken internal links, hreflang, canonical and X-Robots-Tag checks, with report exports
Open toolShowing 1-2 of 48