Regex Tester
Test regular expressions with real-time matching and highlighting
Quick patterns
Highlighted output
Iterate on regex patterns with live highlights
Regex is powerful and easy to get wrong. Testing a pattern against real input — with matches, capture groups, and flags visible live — saves hours of guessing. The tester runs JavaScript regex in your browser so you can refine an expression until it matches exactly what you need without writing a single line of code.
Use the tester when you need to
Build a pattern for log parsing
Iterate against real log lines until the expression captures the timestamp, level, or trace ID cleanly.
Validate input with a regex
Test patterns for emails, phone numbers, slugs, or custom IDs against good and bad samples.
Debug a pattern that misbehaves in code
Paste both the expression and the input from your codebase to reproduce a match issue in isolation.
How to test a regex quickly
- 1
Paste your regex into the pattern field.
- 2
Paste sample text into the input area.
- 3
Toggle flags (g, i, m, s) and watch matches highlight live as you adjust the pattern.
Keep going
Format JSON inputs
Beautify JSON before crafting regex patterns against it.
Format JS that uses regex
Clean up the surrounding code so your regex literal is easy to spot.
Diff text
Compare input and output of regex replacements line by line.
Escape special characters
Escape JSON strings that contain regex metacharacters before embedding them.
Common regex workflows
Iterate live against sample log lines to extract the fields your pipeline needs.
Refine a pattern that accepts only the IDs, emails, or codes your system supports.
Drop a tricky input in to confirm whether your production regex still matches correctly.
Related Tools
JSON Formatter
Beautify JSON from APIs, AI tools, and logs with configurable indentation
JS Formatter
Format, beautify, and minify JavaScript code online
Text Diff & Compare
Line-by-line diff of two texts with additions, removals, and changes
JSON Escape
Escape and unescape special characters in JSON strings
Frequently Asked Questions
The tester uses JavaScript's built-in regex engine, which matches what runs in browsers and Node.js. Patterns that work here will work in JavaScript code without modification.
When your pattern has parentheses, each match shows the captured groups numbered (or named, if you use (?<name>...) syntax). Click a match to expand the group details.
All standard JavaScript regex flags: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), and y (sticky). Toggle them in the flags row to see how they change matching.
Different engines support different features. JavaScript regex doesn't include lookbehind in older browsers, possessive quantifiers, or some Unicode property escapes. Test in the engine you'll actually deploy with.
The tester focuses on matching. For replacements, use the matches and capture groups shown here to construct your replace call (str.replace(pattern, replacement)) in your code.