Regex Playground
Live Regular Expression Tester & Debugger
Build, test, and debug regular expressions in real-time. Features live match highlighting, capture group visualization, and a comprehensive pattern library for JavaScript, Python, and more.
Regex Pattern
Test String
Highlighted Matches
Match Details
Quick Reference
Join Amazon and Flipkart Deals and products under 99 Telegram Channel: @atjust99
What this tool does
This regex playground lets you write a regular expression and immediately see which parts of your test string it matches. Matches light up as you type, capture groups are broken out into a readable list, and you can toggle flags like global or case-insensitive without editing the pattern by hand.
The tool runs entirely in your browser using the JavaScript RegExp engine (ECMA-262). Nothing is sent to a server.
Why another regex tool?
Most online regex testers do the same thing: paste a pattern, see highlights. This one adds a few things I kept wishing other tools had.
First, the capture group panel shows numbered groups, named groups ((?<name>...)), and exact start/end indices side by side. When you're debugging a pattern with five nested groups, not having to mentally map $3 to a substring saves real time.
Second, there's a preset library with common patterns you can load in one click, then tweak. Email validation, UUID matching, IPv4 addresses, ISO dates, US phone numbers. Saves a trip to Stack Overflow.
Third, the flag toggles sit next to the pattern input so you can flip g, i, m, s, or u on and off without retyping anything.
How to use it
- Type your regular expression in the pattern field.
- Paste or type the text you want to test against.
- Matches appear highlighted in the output panel as you type.
- Click any match in the detail list to see its index, length, and capture groups.
- Use the "Patterns" button to load a preset, then modify it to fit your use case.
Quick reference
| Pattern | What it matches | Example |
|---|---|---|
. | Any character except newline | a.b matches acb |
\d | A digit (0-9) | \d{3} matches 123 |
\w | A word character (letter, digit, underscore) | \w+ matches word_1 |
\s | A whitespace character | \s matches a space or tab |
^ / $ | Start / end of string (or line, with m flag) | ^Hello |
* / + | Zero or more / one or more | a* matches empty string or aaa |
? | Zero or one (optional) | colou?r matches color and colour |
[abc] | Any character in the set | [aeiou] matches vowels |
(abc) | Capture group | (id):\d+ captures id |
A few things worth knowing about JavaScript regex
The RegExp engine in browsers follows the ECMA-262 specification. That means:
- Lookbehinds work in all modern browsers (Chrome 62+, Firefox 78+, Safari 16.4+). Older browsers will throw a syntax error.
- Named capture groups use the
(?<name>...)syntax added in ES2018. - The
uflag is needed for correct Unicode handling. Without it, patterns like\p{L}(any Unicode letter) don't work. - The
dflag (hasIndices) returns start and end indices for each capture group. It's supported in Chrome 90+ and Firefox 88+. - ReDoS risk: Patterns with nested quantifiers like
(a+)+can cause catastrophic backtracking. If the playground seems frozen, the pattern is probably ReDoS-vulnerable. Reload the page and simplify your quantifiers.
Who uses this
Developers testing form validation or log parsing rules. Sysadmins writing grep or sed patterns. Students learning regex syntax for the first time. Basically anyone who'd rather see matches highlighted live than stare at a RegExp constructor and guess.
Privacy
All pattern matching runs in your browser's JavaScript engine. No test strings, patterns, or results leave your machine. There is no server-side component for this tool.
Frequently asked questions
Which regex engine does this use?
JavaScript's built-in RegExp, which follows the ECMA-262 spec. The same engine that runs in Node.js, Chrome, Firefox, and Safari.
Can I test lookaheads and lookbehinds?
Yes. Positive and negative lookaheads ((?=...), (?!...)) have been supported for years. Lookbehinds ((?<=...), (?<!...)) require a relatively modern browser (see the compatibility note above).
Why did the page freeze when I typed my pattern?
The most common cause is catastrophic backtracking (ReDoS). A pattern like (a+)+b on a string of aaa... without a b forces the engine into exponential work. Close or reload the tab, then restructure the pattern to avoid nested quantifiers.
How do I use named capture groups?
Write (?<year>\d{4})-(?<month>\d{2}) and the match detail panel will show groups labeled year and month alongside the numbered groups.
Does Unicode work?
Only when the u flag is enabled. Without it, character class escapes like \p{Script=Greek} throw an error.
Can I copy the finished regex directly into code?
Yes. The copy button outputs the pattern and flags in a format you can paste into a new RegExp(...) constructor or a regex literal like /pattern/gi.
Is there a match limit? The tool caps at 10,000 matches to prevent the browser from locking up on very broad patterns against large inputs. If you hit the cap, you'll still see the first 10,000.
What if my pattern works here but fails in Python or Go?
Different engines have different feature sets. Python's re module doesn't support lookbehinds with variable-length patterns, for example. This tool tests JavaScript only. For cross-engine compatibility testing, try regex101.com which supports multiple flavors.
Related tools
- Cron Expression Builder - Build and validate cron schedules visually.
- JSON Validator - Check whether a JSON string is valid and format it.
- Diff Checker - Compare two blocks of text side by side.
- Schema Converter - Turn JSON into TypeScript interfaces or Zod schemas.
Related Tools
HTTP Header Analyzer - Professional Website Security Audit
Developer ToolsScan your website headers for security vulnerabilities, caching efficiency, and information leakage. Get a professional grade (A+ to F) and actionable advice to harden your server.
AI Acronym Finder: Instantly Decode Any Abbreviation
Developer ToolsStruggling with industry jargon? Our AI-powered Acronym Finder provides instant, context-aware definitions for any acronym or initialism. Get clear explanations and usage examples in seconds.
Code Screenshot Generator - Beautiful Code Snippet Images
Developer ToolsTransform your source code into stunning, professional screenshots. Choose from multiple editor themes, vibrant gradients, and macOS-style frames. Perfect for Twitter, LinkedIn, and blogs.
Color Palette Generator - Extract Colors From Image & Hex
Developer ToolsCreate professional color schemes in seconds. Extract palettes from images or generate them from hex codes with instant export to CSS, Tailwind, and Figma.
Cron Expression Builder - Visual Cron Schedule Generator
Developer ToolsCreate and test cron expressions visually. Generate human-readable schedules, preview upcoming run times, and use presets for Linux crontab and automation workflows.
HTML to Markdown Converter
Developer ToolsEffortlessly convert your HTML code into clean, readable Markdown with our free online tool. Perfect for developers, writers, and content managers.
Markdown Table Generator - Professional Online Table Editor
Developer ToolsCreate clean, aligned Markdown tables visually. Features spreadsheet-like editing, CSV/JSON imports, and instant export to Markdown, HTML, and CSV for GitHub and documentation.
Test MCP Server Online - Free Model Context Protocol Debugger
Developer ToolsExplore, test, and debug Model Context Protocol (MCP) servers with our advanced GUI. Discover available tools, execute methods with custom JSON arguments, and monitor real-time logs.
Random CSV Generator - Generate Structured CSV Data
Developer ToolsGenerate random CSV data with custom columns, data types, and export options. Create test data, sample datasets, and structured information for analysis and development.
Random TSV Generator - Generate Tab-Separated Values
Developer ToolsGenerate random TSV data with custom columns and data types. Create structured tab-separated files perfect for data analysis, spreadsheet applications, and simple data exchange.
Schema Converter - JSON to TypeScript & Zod Online
Developer ToolsTransform JSON instantly into TypeScript interfaces, Zod schemas, JSON Schema, or GraphQL types. Features recursive type inference and professional customization options.
SVG Editor & Optimizer - Professional Online Vector Tool
Developer ToolsEdit, clean, and optimize SVG files in real-time. Reduce file size, remove metadata, and preview vector changes instantly for faster web performance.