Regex Tester
100% LocalTest and debug regular expressions with live matches.
Live Parser Active
Matching is performed in real-time as you modify the pattern or text. Unsupported features or invalid syntax will be signaled immediately.
Privacy note
This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.
How to Use Regex Tester
Enter Pattern
Type your regex pattern in the pattern field. Backslashes need proper escaping.
Add Test Text
Type or paste the text you want to match against in the test string area.
Toggle Flags
Enable g (global), i (case-insensitive), or m (multiline) flags to refine matching.
Read Matches
Matches highlight in real time. Check the match table for index, groups, and capture details.
Regex Tester: the essentials
AllDevToolsHub's Regex Tester is a free, browser-based regular-expression playground that highlights matches and capture groups in real time. No installation or account required, all evaluation happens locally in your browser. It runs your pattern against test input using the browser's native JavaScript engine, shows capture groups by index and name, breaks down quantifiers and assertions, and warns about catastrophic-backtracking risk. Patterns and test strings never leave the browser tab, which matters when the test data is a redacted production log or a sensitive PII sample.
Key points
- The tester runs your pattern through the browser's native ECMAScript `RegExp` engine, so results match Node, Bun, and Deno exactly, no PCRE-flavor translation surprises.
- All eight standard JavaScript flags are supported (g, i, m, s, u, y, d), including the ES2022 `d` flag that exposes capture-group start and end indices on each match.
- Catastrophic backtracking from nested quantifiers like `(a+)+b` is the single biggest regex performance trap and was the root cause of the July 2019 Cloudflare global outage.
- Patterns and test input never leave the browser tab, so it is safe to paste redacted production logs, PII samples, or proprietary patterns without privacy concerns.
When to use it
- Debugging a log-parsing pattern that needs to extract timestamps, request IDs, and status codes from millions of lines without misclassifying edge-case format variations.
- Validating form-input regexes (phone numbers, postal codes, license keys) before shipping them to production where a wrong character class blocks legitimate users.
- Rewriting a slow pattern flagged by APM as a hot spot, verify the rewritten version still matches every existing case before deploying to a service handling user traffic.
- Teaching named capture groups, lookbehind, or Unicode property escapes to teammates by stepping through real matches rather than abstract syntax diagrams.
Common mistakes
- Using `.*` instead of `.*?` when extracting content between tags, then wondering why one match swallows the entire document from the first `<` to the last `>`.
- Trying to validate email addresses with regex instead of sending a confirmation email, RFC 5322 grammar is so permissive that any short regex rejects valid addresses.
- Forgetting the `u` flag when matching emoji or non-BMP characters, so `.` treats a single emoji as two surrogate-pair characters and `\p{...}` property escapes silently fail.
- Writing patterns like `^(.*?,){10}$` on user-supplied input, a missing comma triggers exponential backtracking and pegs a CPU core for seconds per request.
Learn More
Regex Cheatsheet for JavaScript and Python (2026 Edition)
Regex Engine Behavior Comparison: JavaScript vs PCRE vs Python โ 12 Patterns That Match Differently
Bundle Analyzer Guide: Identifying and Fixing JavaScript Bloat
Stop shipping unused code. Learn how to use a Bundle Analyzer to visualize your JavaScript dependencies, identify "heavy" libraries, and reduce your bundle size.
What is Regex Tester?
Frequently Asked Questions
Technical Deep Dive
Regex Tester
Regular expressions can be tricky. Our live regex tester provides real-time matching, pattern explanation, and a cheatsheet for common patterns. Debug your expressions across different flags and replacement strings.
regex101 is the classroom. This tester is the same JavaScript engine your browser will run in production, with the sample staying local.
Pattern [A-Z]{2}d{4} on ID AB1234 end should highlight AB1234. Enable g to see every match, not just the first.
Python and PCRE disagree on lookbehind and possessive quantifiers. If you ship Python, re-test there.
01 Common Regex Cheatsheet
| Use Case | Pattern | Notes |
|---|---|---|
| Numbers | -?\d+(\.\d+)? | Includes floats/negatives |
| ISO Date | \d{4}-\d{2}-\d{2} | YYYY-MM-DD format |
| UUID | [0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12} | Standard 36-char ID |
| URL | https?://[^\s]+ | Simple web address |
02 Performance Guardrails
-
Avoid Nested Quantifiers Patterns like
(a+)+cause exponential complexity. Rewrite asa+to prevent ReDoS attacks. -
Anchor Your Patterns Using
^and$helps the engine fail fast on non-matches, significantly improving search speed. -
Atomic Groups While not natively in JS yet, use
(?:...)to group without capturing for cleaner, faster matches.
03 When You Need a Regex Tester (and When You Don't)
Regex is famously the wrong answer to many of the questions developers ask of it. Knowing when to reach for the tester, and when to close the tab and use a parser instead, saves hours:
-
Right tool: log-file extraction Pulling IPs, timestamps, or request paths out of nginx/apache/k8s logs. The grammar is regular, the volume is huge, and you usually want
grep -Ebehavior. Iterate the pattern here, then ship it intoawk,ripgrep, or a CloudWatch Insights query. -
Right tool: form input shape-checks "Looks like a phone number," "looks like a postal code," "matches our internal ID format." Lightweight client-side feedback before you hit the server, not actual validation.
-
Right tool: bulk find-and-replace in an editor VS Code / Sublime / IntelliJ all use the same regex flavor. Prototype the pattern + replacement here (with capture groups via
$1,$2), copy into the editor's Replace panel. -
Wrong tool: parsing HTML or XML The grammar isn't regular, nested tags, attribute quoting variants, comments inside scripts, and the famous Stack Overflow answer is right: use a DOM parser (
cheerio,htmlparser2,BeautifulSoup, the browser'sDOMParser). -
Wrong tool: definitive email/URL validation RFC 5322 emails are too permissive for any sane regex; the only proof an email works is a confirmation message. For URLs, use
new URL(str)in JS orurllib.parsein Python and check the result.
04 Worked Examples
(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})
Released on 2025-11-14, deprecated 2026-05-01
1: 2025-11-14 โ { year: '2025', month: '11', day: '14' }
2: 2026-05-01 โ { year: '2026', month: '05', day: '01' }
Named groups land as match.groups.year in JS. Self-documenting compared to match[1] / match[2].
<a>link</a><b>bold</b>
<.*>:one match, the entire string
<.*?>:4 matches: <a>, </a>, <b>, </b>
The lazy quantifier asks "smallest match that satisfies the pattern." Critical for any "extract from delimiter to delimiter" task, and the #1 reason a working regex breaks the moment you add a second occurrence to the input.
^(a+)+$
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!
V8 spends multiple seconds exploring 2^31 paths before reporting "no match." This is the Cloudflare 2019 outage in miniature, a single regex took the global CDN offline for 27 minutes.
^a+$
Remove the nested quantifier. The matching power is identical; the engine no longer has ambiguous decisions to backtrack through.
05 Related Tools
Regex rarely shows up alone. The companions below cover the next step, generating patterns from examples, looking up syntax you've half-forgotten, and finding alternate strategies when regex is the wrong fit:
Regex Generator
Provide example strings, get a candidate regex. Starting point for the tester rather than building from scratch.
Regex Cheatsheet
Single-page reference for quantifiers, anchors, character classes, and Unicode property escapes, the things you keep forgetting.
Find & Replace
Interactive search-and-replace with regex support and live preview of what your replacement will change.