Regex tester (JavaScript)

Type a pattern, as /…/flags or bare, and the text to search. It runs in this browser's JavaScript engine. The gray text is an example.

Example: dates, with the year as a named group.

Matches
 

Each match with its groups
#MatchAtGroups

Good to know

Which engine
Your browser's JavaScript engine, the same that runs text.match(/…/) in a web page or Node.js. Patterns written for PCRE (PHP), Python or .NET can behave differently: JavaScript has no possessive quantifiers, no \A or \Z, and a $ with the m flag also matches before a \r.
Flags
Write them after the pattern: /cat/gi. A pattern typed without slashes is searched for every match (g). Without g only the first match is shown, as exec finds it.
Positions
Counted as JavaScript counts string positions, in UTF-16 units: a character such as 😀 counts as 2. Without the u flag a match can start inside such a character; with u (or v) it cannot. An empty match shows as a thin mark.
Slow patterns
A pattern that backtracks without end, such as (a+)+$ on a long run of a's followed by another letter, is stopped after 0.3 seconds instead of freezing the page.
Open from a link
?pattern=/\d+/g&input=a1b22 opens the page with that pattern and text. A + stays a +; write a space as %20, & as %26 and # as %23.