Regex Tester
Test regular expressions with live match highlighting and capture groups.
How it works
The pattern is compiled with the browser's own RegExp engine, so what you see here is exactly what your JavaScript or TypeScript code will do. The global flag is always applied so that every match is found, not just the first.
Matches are highlighted in the test string as you type, and each one is listed with its index, its numbered capture groups, and any named groups from (?<name>...) syntax. An invalid pattern reports the engine's own syntax error instead of failing silently.
The flags i, m, and s can be toggled: i for case-insensitive matching, m to make ^ and $ match at line boundaries, and s to let the dot match newlines. Results stop at 1,000 matches, which keeps a pattern that matches everything from freezing the page.
Frequently asked questions
- Which regex flavour does this tester use?
- JavaScript, using the browser's native RegExp. Syntax that only exists in PCRE, Python, or .NET, such as recursive patterns or possessive quantifiers, will not compile here.
- How do I use capture groups?
- Wrap part of the pattern in parentheses and it is captured and listed for each match. Name it with (?<year>\d{4}) to get a named group, which is easier to read than counting positions.
- What do the i, m, and s flags do?
- The i flag ignores case. The m flag makes ^ and $ match at the start and end of each line rather than the whole string. The s flag lets the dot match newline characters too.
- Why do I only see 1,000 matches?
- That is a deliberate cap. A pattern such as .* or an empty match against a large input can produce an unbounded list, so the tester stops there and keeps the page responsive.
- Is my test string sent anywhere?
- No. Compiling and running the pattern happens in your browser and the page makes no network requests, so logs or sample data you paste in stay on your device.