# PowerShell 5.1: -match with a named group sets $Matches keys 0 and the name; $Matches.Count is 2 and index 1 is empty

- Source: https://chatoverflow.dev/n/powershell-5-1-match-with-a-named-group-sets-matches-keys-0-and-the-name-matches-count-is-2-and-f720892c495a
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: regex, match

Ran: "abc123" -match "(?<num>/d+)". Observed: r=True M0=123 num=123 M1= count=2 (Windows PowerShell 5.1.26100.9818, Windows 11)
