Advanced Regex Tester
Test regular expressions with full flag support (g, i, m, s, u, d), capture group inspection, real-time match highlighting, and preset patterns. Scroll down for a complete regex cheat sheet.
Regex Cheat Sheet
Character Classes
. Any character except newline \w Word character [a-zA-Z0-9_] \d Digit [0-9] \s Whitespace (space, tab, newline) \W \D \S Negated versions of \w \d \s [abc] Any of a, b, or c [^abc] Not a, b, or c [a-z] Character range a through z Anchors
^ Start of string (or line in multiline mode) $ End of string (or line in multiline mode) \b Word boundary \B Not a word boundary Quantifiers
* 0 or more (greedy) + 1 or more (greedy) ? 0 or 1 (optional) {n} Exactly n times {n,} n or more times {n,m} Between n and m times *? +? ?? Lazy/non-greedy versions Groups & Lookarounds
(abc) Capture group — accessible as $1, $2… (?:abc) Non-capturing group — groups without capturing (?<name>abc) Named capture group (?=abc) Positive lookahead — followed by abc (?!abc) Negative lookahead — not followed by abc (?<=abc) Positive lookbehind — preceded by abc (?<!abc) Negative lookbehind — not preceded by abc Flags
g Global — find all matches, not just the first i Case-insensitive matching m Multiline — ^ and $ match each line s Dotall — . matches newlines too u Unicode — enables full Unicode matching d Indices — include match start/end index in results Frequently Asked Questions
What is a capture group in regex?▼
A capture group (abc) captures the matched substring so you can reference it later — in replace operations as $1 or backreferences as \1. Named groups (?<name>abc) let you reference by name with $<name> or \k<name>. Non-capturing groups (?:abc) group without capturing, useful for alternation or quantifier scope.
What is the difference between greedy and lazy quantifiers?▼
Greedy quantifiers (* + ?) match as much as possible. Lazy quantifiers (*? +? ??) match as little as possible. Example: <.+> on '<div><p></p></div>' — greedy matches the whole string, lazy matches just '<div>'. Use lazy when you want the shortest possible match.
When should I use a lookahead?▼
Use a lookahead (?=...) when you want to match only if followed by a pattern, without including that pattern in the match. Example: \d+(?= dollars) matches the number in '100 dollars' but not in '100 euros'. Negative lookahead (?!...) does the opposite.
What does the 'm' flag do?▼
The multiline flag makes ^ and $ match the start and end of each line (separated by \n), instead of only the start and end of the entire string. Without 'm', ^ only matches at position 0. With 'm', it matches after every newline too.
How do I match a literal dot or special character?▼
Escape special characters with a backslash: \. for a literal dot, \* for a literal asterisk, \( and \) for literal parentheses. Special regex characters that need escaping: . * + ? ^ $ { } [ ] | ( ) \
Related Products
on GumroadDeveloper Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →TypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
Regex Tester Pro
Free Regex Tester Pro with real-time match highlighting. Test regular expressions with live visual feedback. Supports JS, Python, and Ruby flavors, all flags, capture groups, and 6 built-in presets. R
Open free tool →
Regex Tester
Free regex tester. Test regular expressions against multiple strings with expected match/no-match assertions — see instant pass/fail results. Built-in presets for email, URL, IPv4, and phone. Pro: unl
Open free tool →
AI Regex Explainer — Pro Tool
Paste any regular expression and get a plain-English breakdown, match examples, and gotchas. Explains capture groups, lookaheads, and common mistakes. Free regex explainer tool. DevPlaybook Pro featur
Open free tool →
More Free Tools
Related Articles
Test-Driven Development Guide 2026: Practical TDD That Actually Works
Learn TDD the practical way in 2026. Red-green-refactor workflow, real-world examples in JavaScript and Python, when TDD helps vs hurts, and how to introduce it to your team.
Modern JavaScript Testing 2026: Vitest vs Jest vs Playwright
Complete guide to JavaScript testing in 2026. Compare Vitest vs Jest for unit tests, Playwright vs Cypress for E2E, component testing, coverage tools, and CI/CD integration.
Modern TDD in 2026: Test-Driven Development with Vitest, Playwright & AI Copilots
Test-Driven Development has evolved. This practical guide covers modern TDD workflows using Vitest for unit tests, Playwright for E2E, MSW for API mocking, and how AI coding assistants (GitHub Copilot, Claude Code) are changing how we write tests first.
Playwright vs Cypress vs Puppeteer 2026: Which Testing Tool Should You Choose?
Playwright vs Cypress vs Puppeteer 2026 — compare feature sets, performance, developer experience, parallel testing, CI costs, and browser support. Find the right E2E testing tool for your stack.
Vitest: The Fast Unit Testing Framework for Vite Projects - 2026 Guide
Complete guide to Vitest in 2026: setup, configuration, mocking, coverage, watch mode, and a detailed comparison with Jest to help you decide which testing framework fits your project.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →