Regex Tester
Test regular expressions with live matching, highlighting, and group extraction.
Related Tools
From the makers of JSON Knife
Get the JSON & API Cheat Sheet
Formatting tricks, jq commands, and common patterns — one page, zero fluff.
How to Test Regular Expressions Online
Writing regex without a tester is like writing SQL without a database — you're just guessing. This regex tester lets you write a pattern, paste in test strings, and instantly see matches highlighted. It uses JavaScript's regex engine, so the behavior matches exactly what you'll get in Node.js, browser JS, and TypeScript.
The tool highlights all matches, shows captured groups, and flags syntax errors in real time. This is faster than the write-run-debug loop of testing regex in your actual codebase, especially when you're working with complex patterns involving lookaheads, named groups, or Unicode properties.
Common use cases include validating email formats, extracting data from log lines, parsing URLs, and writing input validation patterns. The tester supports all JavaScript regex flags including g (global), i (case-insensitive), m (multiline), s (dotAll), and u (Unicode). Everything runs client-side.
Tips
- Start simple and build up. Get the basic match working before adding groups, quantifiers, and assertions.
- Use named groups
(?<name>...)for readability:/(?<year>\d{4})-(?<month>\d{2})/is clearer than/(\d{4})-(\d{2})/. - Beware of catastrophic backtracking — patterns like
(a+)+can freeze on certain inputs. Use atomic groups or possessive quantifiers where available. - JavaScript regex and PCRE (PHP, Python) have subtle differences — test in the engine your code actually uses.