Regex Tester
Test regular expressions live — highlighted matches, numbered & named capture groups, per-match line:column, and a replacement preview.
About this ToolHow it works, benefits & use casesTap to collapse
The Regex Tester (regular expression tester) evaluates a JavaScript regular expression against your test string and shows the results the moment you type. Enter a pattern and flags (any combination of g, i, m, s, u, v, y), paste the text to match, and the tool highlights every match inline and lists each one with its character index and a line:column position. For patterns with capture groups it breaks out the numbered groups ($1, $2, …) and any named groups (?<name>...) per match, so you can verify your captures are landing where you expect. An optional replacement field runs String.replace live and shows the rewritten output, letting you preview substitutions with $1 or $<name> references before using them in code. Invalid patterns and bad flags surface a clear error message instead of throwing. Evaluation is debounced and happens entirely in your browser — nothing is uploaded, and it is free to use.
How to Use
- 1Type your regular expression into the Pattern field, or click "Load example" for a working named-group sample.
- 2Set the Flags (for example g for global, i for case-insensitive, m for multiline) in the small flags field.
- 3Paste the text to match into the Test string panel — matches highlight and update live as you type.
- 4Optionally enter a Replacement (using $1, $<name>, or literal text) to preview a String.replace result.
- 5Review the highlighted matches, the numbered and named capture groups, and the per-match line:column under "Matches".
Key Benefits
- Live, debounced matching highlights every hit as you type
- Per-match index plus line:column makes locating matches in multiline text easy
- Breaks out both numbered ($1) and named (?<name>) capture groups for each match
- Optional replacement field previews String.replace output with $1 / $<name> references
- Supports all JavaScript flags: g, i, m, s, u, v, and y
- Clear, non-throwing error messages for invalid patterns or flags
- Safe against zero-length-match infinite loops; runs entirely in-browser
Common Use Cases
- Debugging a validation or parsing regex before pasting it into application code
- Confirming that named capture groups extract the right substrings
- Prototyping a find-and-replace transformation with a live preview
- Counting and locating every occurrence of a pattern in a log or text dump
- Learning regex syntax and flag behavior with instant visual feedback
Pattern
Live preview of String.replace with this pattern
Live evaluation — matches update as you type.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related guides
- Announcement · 18 min readWelcome to consolelog.tools: 300+ Free Developer Tools, Zero InstallationThe story behind building consolelog.tools - a comprehensive platform with 300+ free developer utilities. Learn about our mission, technology stack, and vision for the future of developer productivity.Read the guide
- Guide · 14 min readPublic Form APIs: What You Can and Can't Trust From the BrowserYour form is a suggestion; your endpoint is the contract. A practical guide to securing contact forms, newsletters, comments, and feedback endpoints: server-side validation, email header injection, honeypots and rate limiting, anchored origin checks, client-supplied identity, and double opt-in.Read the guide
Related tools
- Regex Test Case GeneratorGenerate comprehensive test cases for regular expressions
- Find and ReplaceFind and replace text with support for regex
- Case ConverterConvert text to camelCase, snake_case, kebab-case, and more
- Text Diff CheckerCompare two texts and highlight differences
- HTML MinifierMinify HTML code
- HTML to MarkdownConvert HTML to Markdown
It accepts any combination of the standard JavaScript flags: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), v (the unicode-sets mode), and y (sticky). Entering an unsupported character shows an "Invalid flags" message rather than running.
Yes. For each match the tool lists numbered groups as $1, $2, and so on, and separately lists any named groups defined with (?<name>...) along with their captured values. Empty captures are labeled "(empty)" so you can tell them apart from a failed match.

