Regex Tester
Test a regular expression against sample text with live highlighting and a match count.
How to use
- Type your pattern between the slashes and add flags (g, i, m).
- Enter or paste the text to test.
- Matches are highlighted live with a running count.
How the Regex Tester works
Tests a regular expression against sample text with live highlighting, so you can iterate on a pattern without a run-edit-rerun cycle.
Your pattern is compiled with the JavaScript RegExp engine and run against the test string, with matches and capture groups highlighted as you type.
flags: g global · i case-insensitive · m multiline · s dot matches newline
Worked example
The pattern \b\w+@\w+\.\w+\b picks email-shaped substrings out of a paragraph.
Things worth knowing
- This uses JavaScript's regex dialect. PCRE, Python and Go differ in lookbehind support, named group syntax and escaping.
- Nested quantifiers such as (a+)+ can cause catastrophic backtracking, hanging on inputs only slightly longer than expected.
- Do not parse HTML with regex. Use a DOM parser — nested and optional tags defeat any pattern you can write.
Frequently asked questions
What flags are supported?
All standard JavaScript flags, including g (global), i (case-insensitive) and m (multiline).
Does it run on a server?
No — matching uses your browser's regex engine, so nothing is sent anywhere.
Why does my pattern match nothing?
Usually unescaped special characters. Literal . + * ? ( ) [ ] { } | ^ $ \ all need a backslash.
What is the difference between greedy and lazy?
Greedy quantifiers take as much as possible; adding ? makes them lazy and take as little as possible. .*? is the usual fix for a match that swallows too much.