Regex Tester
See what a pattern matches, and what it captures.
About this converter
Type a pattern, see every match with its position, its line, and everything it captured — numbered groups and named ones alike.
The captures are the point. A pattern that matches the right text while capturing the wrong part of it is the commonest bug in this area, and it is invisible until you look at the groups.
A runaway pattern is stopped rather than allowed to hang the page. Nested quantifiers — something shaped like (a+)+ — can take exponential time on text that almost matches, and a tester that freezes on a half-written pattern is worse than no tester. Anything still running after about a second is halted and explained.
This is JavaScript's regular expression engine, which is what a browser, Node and Deno all use. Most patterns are portable, but lookbehind, named groups and unicode property escapes are not universal across languages.
Frequently asked questions
Which flavour of regex is this?
JavaScript — ECMAScript regular expressions, exactly as a browser or Node runs them. Most syntax is shared with PCRE, Python and Ruby, but not all: possessive quantifiers and atomic groups do not exist here, and lookbehind is supported where it is not everywhere else.
Do I include the slashes?
No. Write the pattern on its own and put the flags in their own box. A leading and trailing slash would be matched as literal characters.
Why was my pattern stopped?
It was taking exponential time, which happens when nested quantifiers backtrack over text that nearly matches — (a+)+ against a long run of a followed by b is the classic example. It is the same weakness that causes real outages, so it is worth fixing rather than working around: anchor the pattern, or make the inner repetition specific.
Why is g always on?
Because every use of a tester is "show me all of them". Without it the search would return the first match for ever rather than advancing through the text.
Does what I paste get sent anywhere?
No. Everything runs in your browser, on your own machine. Nothing is uploaded and nothing is logged. That matters more here than on most pages — source code, database queries and internal data are exactly the things that get pasted into tools like this, and most of them are a form that posts to a server.