Date Regex — Match YYYY-MM-DD with Groups
Debug JavaScript regular expressions live: highlighted matches, capture groups, flags, and replacement preview.
Result
This page preloads a pattern for ISO 8601 dates: (?<year>\d{4})-(?<month>0[1-9]|1[0-2])-(?<day>0[1-9]|[12]\d|3[01]). Instead of accepting any digits, the month group only allows 01–12 and the day group 01–31 — the sample text demonstrates this with 2026-13-01 and 2026-00-10, which stay unmatched.
The three named groups are the practical payoff: in the match list below the text you see year, month and day extracted separately for every date found. In code, the same groups let you write result.groups.year instead of counting parentheses — and in the replacement field here you can reorder a date as $<day>.$<month>.$<year> to convert ISO dates to European notation in one pass.
A regex cannot know that February has 28 days — 2026-02-31 will still match. That is normal: the pattern's job is to find date-shaped strings and split them into parts; final calendar validation belongs to your code. Paste your own logs or CSV exports and see how the pattern behaves on real data.