Runs entirely in your browser — nothing leaves this page.
Regex tester
Test JavaScript regular expressions: highlighted matches, capture groups and a replace preview.
Testing a regular expression
The pattern runs against your test string with the flags you select, highlighting every match and listing capture groups — numbered and named. The replace mode previews the result of String.replace with the same pattern.
The engine is the browser's own, so what you see is exactly what your JavaScript will do.
Will this pattern work in Python or Go?
Mostly, but not always. Named groups differ in syntax, Go's RE2 has no backreferences or lookaround at all, and character class shorthands treat Unicode differently. Test in the language you will ship in before trusting a pattern across engines.
Why is only the first match highlighted?
The global flag is off. Without g, a regex stops at the first match — which is also why a replace without g changes only one occurrence, a bug that survives review surprisingly often.
What is catastrophic backtracking?
Nested quantifiers over overlapping alternatives — (a+)+b is the textbook case — can take exponential time on a non-matching input. If your pattern is fast here and slow in production, the difference is the input, not the engine. Never build a regex from untrusted input.
How do I match across lines?
Two different flags, often confused. The m flag makes ^ and $ match at each line break; the s flag makes . match a newline as well. If you want a pattern to span lines, you usually want s.
Related tools: Cron parser, YAML / JSON / TOML and Base64.