Test JavaScript Regular Expressions With Live Highlights
Regex Tester evaluates ECMAScript regular expressions in real time against your sample text—highlighting every match inline, inspecting numbered and named capture groups ((?<name>...)), and previewing $1 / $& string replacements. Execution runs locally inside your browser's JavaScript engine so private logs, emails, and source snippets never leave your machine.
Supported Regex Flags & Inspection Features
| Flag / Feature | Meaning |
|---|---|
g (Global) |
Finds all matches in the input instead of stopping at the first |
i (Ignore Case) |
Matches uppercase and lowercase letters identically |
m (Multiline) |
Makes ^ and $ match start/end of each line, not just the full string |
s (DotAll) |
Allows . to match newline characters (\n) |
u (Unicode) |
Enables full Unicode code-point matching and \p{...} property escapes |
| Replace Preview | Live substitution using $1, $2, $<name>, and $& backreferences |
Tips for Cleaner Patterns
- Avoid catastrophic backtracking: Replace nested quantifiers like
(a+)+with specific character classes or non-greedy quantifiers (+?). - Use named capture groups:
(?<year>\d{4})-(?<month>\d{2})makes complex log and date parsers far easier to maintain.
Need more pattern utilities? Try Regex Match Extractor, Regex Escape, Regex Splitter, or explore all Developer Tools.
Frequently asked questions
Which regex flavor does this tester use?
It uses your browser's native ECMAScript (JavaScript) RegExp engine, supporting lookbehinds (?<=...), named capture groups (?<name>...), and Unicode property escapes with the u flag.
Why is my pattern only matching the first occurrence?
Without the g (global) flag, JavaScript's regex engine stops after the first match. Enable the g flag in the toolbar to highlight every occurrence across your test text.
How do I reference capture groups in replacement strings?
Use $1, $2 for numbered capture groups or $<name> for named groups in the replacement field—for example, swapping "Last, First" to "$2 $1".
Related free tools
All Developer tools →Regex Match Extractor
Extract every regex match or capture group into a clean copyable list.
Regex Escape
Escape special regex metacharacters in literal strings safely.
Regex Splitter
Split text blocks by custom regular expression delimiters locally.