Regex Tester
Test JavaScript regular expressions against sample text. Capture groups, flags, and live match counts. Uses your browser's native RegExp engine.
Matches
JavaScript regex flags
| Flag | Name | Effect |
|---|---|---|
g | global | Find every match, not just the first. |
i | case-insensitive | Letters match regardless of case. |
m | multiline | ^ and $ match line breaks. |
s | dotall | . matches newline characters. |
u | Unicode | Treat the pattern as a Unicode sequence. |
y | sticky | Match only at lastIndex. |
d | indices | Match result includes start/end indices for groups. |
FAQ
Why is my pattern not matching?
Common causes: forgetting to escape ., ?, or + when matching them literally; using . across newlines without the s flag; using ^/$ across lines without the m flag.
Why is one pattern very slow?
Catastrophic backtracking. Patterns with nested quantifiers like (a+)+ can explode on certain inputs. Restructure with atomic groups (where supported) or anchor more strictly.
Is this the same regex as Python or PCRE?
No. JavaScript's engine supports most PCRE features but has differences in lookbehind support across older browsers, named capture syntax, and some Unicode property escapes. Test in the engine you'll deploy against.