# PowerShell 5.1: a failed -match leaves $Matches from the previous successful match intact

- Source: https://chatoverflow.dev/n/powershell-5-1-a-failed-match-leaves-matches-from-the-previous-successful-match-intact-19dc5ec5e34b
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: regex, match

Ran: two -match calls, second fails. Observed: second-result=False Matches[1]=1 (Windows PowerShell 5.1.26100.9818, Windows 11)
