Updated · Built and checked by the PlinzoTools team, formulas tested against published sources
Test a regular expression against sample text and see every match.
1. "42" at index 10
2. "7" at index 24This tool runs a JavaScript regular expression against your test text and lists every match, its position, and any capture groups -- useful for debugging or building a regex without repeatedly re-running it in actual code.
Enter a pattern, flags (like "g" for global, "i" for case-insensitive), and test text. Every match found appears with its position and captured groups.
The pattern is compiled into a JavaScript RegExp (the global flag is automatically ensured so all matches are found, not just the first). Each match reports its matched text, character index within the test string, and any parenthesized capture groups.
For a pre-built email or domain format check instead of writing your own regex, see the Email Validator or Domain Name Validator.
The results panel shows a count of matches and a numbered list. Each line gives the matched text in quotes, the zero-based index where it starts in your test text, and, when the pattern has parentheses, the captured groups in order. The default example is the pattern \d+ against "There are 42 apples and 7 oranges." It finds two matches: "42" at index 10 and "7" at index 24. Index positions count every character including spaces, starting from 0.
Suppose the pattern is (\w+)@(\w+)\.com and the text is "mail bob@site.com now". There is one match, "bob@site.com", at index 5, with two groups: bob and site. A group that does not take part in a particular match (for example inside an optional alternative) appears as an empty entry in the list. Named groups still show only their values, in order.
An unsupported or repeated flag letter produces an error message from the browser's regular expression engine, shown in the results panel.
Type the pattern exactly as you would between the slashes in a JavaScript regex literal. Do not add surrounding slashes and do not double the backslashes. To match a digit, type \d, not \\d. If your pattern comes from a string in source code where backslashes were doubled, halve them here, and double them again when you paste the finished pattern back into a string.
Results are capped at 10,000 matches. A badly designed pattern with nested repeating groups, for example (a+)+ against a long run of a followed by a different character, can take extremely long to evaluate in any backtracking engine and may make the browser tab unresponsive. If the page freezes, reload it and simplify the pattern. Remember also that some newer features, such as lookbehind, depend on your browser's version. Finally, a regex that works here is written for JavaScript; before using it in Python, PHP or another language, check that language's documentation for syntax differences.
Without it, a regex only finds the first match; this tool automatically adds it if missing, since seeing every match is almost always what you want when testing a pattern.
Parenthesized parts of a pattern, like (\d+), that extract a specific sub-portion of each match separately -- shown alongside the full match in this tool's results.
Yes -- since this runs in your browser using JavaScript's native RegExp engine, syntax matches JavaScript exactly, which differs slightly from other languages' regex flavors (like Python or PCRE) in some edge cases.
Groups are shown in order of their opening parenthesis, so the first group in the pattern appears first, followed by the second, and so on.
Indexes start at 0, not 1, and spaces and line breaks each count as one character. A match at the very start of the text has index 0.
No. If g is missing the tool adds it, so it always lists every match. Read the first line of the list for the first match.
The pattern or flags are invalid, for example an unclosed parenthesis or an unknown flag letter. The message comes from the browser's own regex engine and usually points to the problem.
Reference: MDN Web Docs