Regex Tester
Test regex and highlight matches.
ToolHub Pro — Remove ads and unlock one-click file export on text-output tools below (image tool keeps its own download).
Unlock Pro on this tool
Per-line match summary · One-click export download
You may also need
About
Test regular expressions with flags and inspect matches quickly. Useful for log parsing, data cleanup, and validating patterns before shipping them to production. Runs locally in your browser.
Use cases
- Validate a regex before adding it to a backend validation rule.
- Extract IDs/emails from logs using capture-friendly patterns.
- Tune performance by simplifying overly greedy patterns.
Common pitfalls
- Patterns that work in PCRE might fail in JavaScript (engine differences).
- Nested quantifiers can cause catastrophic backtracking on long strings.
- Remember to escape backslashes properly when copying from code into a regex literal/string context.
Examples
Input
pattern=\b\w+\b, flags=g
Output
Matches words
FAQ
Which flags should I use?
Common flags are g (global), i (ignore case), m (multiline). Combine them like gim depending on your needs.
Why does my regex error?
It’s usually invalid syntax or missing escapes. Remember to escape backslashes (\) properly.
Why does it match differently than my backend?
Different engines have different features (lookbehind, atomic groups, etc.). This tool uses JavaScript’s RegExp engine.
How do I avoid slow regex performance?
Avoid nested quantifiers like (a+)+ and prefer more specific character classes and boundaries when possible.
Limitations
- Regex behavior follows JavaScript RegExp semantics (some syntax differs from PCRE/RE2).
- Catastrophic backtracking patterns can be slow on large inputs.
Recommended
Affiliate slots. Configure real links via environment variables.
No recommendations configured.