JavaScript syntax, without the slashes. Flags go in their own box.
2
Paste the test text
Real sample data is better than an invented string.
3
Read the matches
Each match with its index and captured groups, and an optional replacement preview.
This is the JavaScript flavour
Patterns are compiled by the same engine that runs scripts in your browser, so what works here works in your code. That also means patterns written for PCRE, Python, Java or .NET can fail: \A and \z do not exist, (?<name>…) is written differently, and possessive quantifiers are not supported.
Lookbehind is supported in current browsers but was missing for years, so a pattern that needs it will fail in older Safari. Named groups are (?<year>\d{4}) and are listed with the numbered ones in the result.
Flags that change everything
g finds every match rather than the first. i ignores case. m makes ^ and $ match at every line instead of only at the start and end of the text. s lets a dot match a newline, which is otherwise the most common reason a multi-line pattern matches nothing.
u enables Unicode mode, where a dot matches one code point rather than one 16-bit unit and a property escape such as \p{Letter} works. y is sticky: it anchors each match to where the last one ended. This tool adds g when it is missing, because a tester that lists only the first match is rarely what anyone wants.
Catastrophic backtracking
Some patterns take exponential time on some inputs, and a browser tab has no way to interrupt a regular expression once it starts. A nested quantifier such as (a+)+$ against a long string of a's with one b at the end can freeze the page. If the tab stops responding, close it and simplify the pattern.
The usual fixes are to anchor the pattern, to avoid nesting quantifiers, and to use a negated character class instead of a lazy dot where you can. The replacement preview uses the same engine, so a $1 that does not work here will not work in your code either. For line-level comparisons rather than patterns, see the text diff.
Frequently asked questions
Which regex flavour is it?JavaScript's, the one the browser runs. PCRE-only syntax will not work.Why is only one match shown?g is added automatically when missing, so every match is listed. Check the pattern for anchors that limit it.How do I see capture groups?Groups are numbered $1, $2 and so on in the result, including named groups.Can I preview a replacement?Yes. Type a replacement and the result of replacing every match is shown below the matches.Is my text uploaded?No. The pattern and the text are evaluated in this tab.Why did my pattern from another language fail?Different engines support different syntax. Lookahead is common, lookbehind and possessive quantifiers are not.