Regex Tester
Write a pattern, paste some text and see every match, group and explanation update as you type. Everything runs in your browser — the share link carries the whole session.
Regular expression
ECMAScript (JavaScript) flavor/
/gm
Matching…
Test string
153 charsFunction
Matches are highlighted in the test string; details are under Match information. Switch to Substitution to replace matches, or List to output a template for each match.
Code generator
const regex = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/gm;
const str = "Release dates:\nv1.0 shipped on 2024-03-18 after a long beta.\nv1.1 followed on 2024-07-02, and v2.0 on 2025-01-27.\nNot dates: 2024-3-8, 20240318, 24-03-18";
for (const match of str.matchAll(regex)) {
console.log(`Found "${match[0]}" at ${match.index}`, match.slice(1), match.groups);
}