What Is This Tool?
A regular expression (regex) is a compact pattern language for finding, validating and extracting text: an email pattern can validate form input, \d{4}-\d{2}-\d{2} finds dates, and capture groups pull out the parts you need. Nearly every programming language and editor supports regex.
This tester uses the JavaScript regex engine — the same one that runs in Node.js and every browser — so patterns you build here behave identically in your JavaScript/TypeScript code. Most patterns also work unchanged in Python, Java and Go.
Why Use It?
- Live feedback: matches highlight in yellow as you type the pattern.
- Capture groups shown per match — see exactly what $1 and $2 will contain.
- Full flag support: g (all matches), i (ignore case), m (multiline), s (dot matches newline), u (unicode).
- Clear error messages when the pattern has a syntax mistake.
- Free and private — pattern and text never leave your browser.
How to Use
- Type your pattern between the two / characters (no need to escape slashes yourself).
- Adjust flags in the small box after the second / — the default g finds all matches.
- Paste your test text below.
- Matches highlight instantly; capture groups are listed underneath.
- If the pattern is invalid, the error message explains what's wrong.
Example
Input
Pattern: (\w+)@(\w+)\.com
Test string: Contact [email protected] or [email protected]Output
✓ 2 matches
#1 groups: $1=alice $2=example
#2 groups: $1=bob $2=testThe parentheses create capture groups you can reference as $1 and $2 in replacements.
Frequently Asked Questions
Which regex flavor does this tester use?
JavaScript (ECMAScript), the engine in every browser and Node.js. Core syntax is portable, but some features differ across languages — e.g. lookbehind support and named group syntax vary in Python and Java.
Why does my pattern only find the first match?
The g (global) flag is missing. Without g, a regex stops after the first match. This tool defaults to g — check you haven't removed it.
Why does . not match my line breaks?
By default . matches any character except newlines. Add the s flag (dotall) to make . match newlines too, or use [\s\S] as a portable alternative.
What do the capture group results mean?
Each pair of parentheses in your pattern captures the text it matched. $1 is the first group, $2 the second, and so on — these are what you reference in replace operations and extraction code.
Why is my regex slow or freezing?
Likely catastrophic backtracking, caused by nested quantifiers like (a+)+ on non-matching input. Rewrite the pattern to avoid ambiguous repetition. This tool caps at 1000 matches to stay responsive.