Exercise 2: Finding All Three Email Addresses — Possible Solution ==================================================================== WHY -match ONLY SURFACES ONE ADDRESS ------------------------------ Per this chapter's own central finding, -match against a single string only ever tells you two things: whether a match exists, and the details of exactly ONE match, stored in $Matches. It was never designed to enumerate every occurrence of a pattern inside a longer string - no matter how many times the pattern genuinely appears in the text, -match and $Matches together can only ever surface the first one found. THE CORRECT TOOL ------------------------------ [regex]::Matches(), reached through the [regex] type accelerator, is the correct tool - per this chapter, it returns a full collection of every match found in the string, not just the first. HOW TO USE IT ------------------------------ [regex]::Matches($text, '\w+@\w+\.\w+') | ForEach-Object { $_.Value } This runs the email-matching pattern against the full text and returns every match as a separate object in the collection, each with its own .Value property holding that specific match's text - piping through ForEach-Object and reading .Value on each one (as this chapter's own example demonstrated) surfaces all three email addresses, not just the first. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains, using this chapter's own central finding, why -match structurally can't surface more than one match, and correctly names and demonstrates [regex]::Matches() as the tool that returns every match in the string.