Text Processingflags: gm

Keep-a-Changelog Entry Header

Match Keep-a-Changelog style version headers like `## [1.2.3] - 2024-01-15` or `## 2.0.0`.

Try it in RegexPro →

Available in

Pattern

regexengine-agnostic
^##\s+\[?([\w.\-]+)\]?(?:\s*-\s*(\d{4}-\d{2}-\d{2}))?   (flags: gm)

Raw source: ^##\s+\[?([\w.\-]+)\]?(?:\s*-\s*(\d{4}-\d{2}-\d{2}))?

How it works

^## matches the markdown H2 marker. \s+ requires whitespace. \[? optionally matches an opening bracket. ([\w.\-]+) captures the version (semver, calendar version, or label like `Unreleased`). \]? optionally matches the closing bracket. (?:\s*-\s*(\d{4}-\d{2}-\d{2}))? optionally captures an ISO date.

Examples

Input

## [1.2.3] - 2024-01-15\n## [Unreleased]

Matches

  • ## [1.2.3] - 2024-01-15
  • ## [Unreleased]

Input

## 2.0.0 - 2025-12-25

Matches

  • ## 2.0.0 - 2025-12-25

Input

# Title

No match

Common use cases

  • Automated changelog parsing in release tooling
  • Versioned doc generation
  • Migrating between changelog formats
  • CI checks for missing/empty release sections