Regex Tester
Type a pattern, see live match highlights, capture groups, and replace previews. JavaScript regex flavor with all flags. Common patterns are one click away.
Live highlight
Capture groups
Replace mode
Pattern library
/
/
0 matches
g global
i ignore case
m multiline
s dotall
u unicode
y sticky
Test string
matches: 0
How to read a regex
Slashes mark the boundaries: /pattern/flags. The pattern is what to match, the flags change how the engine matches. g finds all matches, i ignores case, m makes ^ and $ match line boundaries, s lets . match newlines.
Capture groups
Parentheses create groups. (\w+)@(\w+\.\w+) captures the local part as group 1 and the domain as group 2. Use them in Replace mode with $1 and $2. Named groups (?<name>...) are available with $<name>.
Common gotchas
- Backslashes need escaping in JS strings but not here, since you are typing the regex source directly.
- Without
g,String.replaceonly replaces the first match. .does not match newlines unless you adds.- Catastrophic backtracking can hang the engine on long inputs. If your pattern has nested quantifiers like
(a+)+, simplify it.