Strings In Depth15 / 16
Up next

-match and -replace

$s = "order #4271 shipped"
# -match tests a regex and fills $matches
if ($s -match '#(\d+)') {
    Write-Output "id is $($matches[1])"
}
# -replace substitutes with a regex
Write-Output ($s -replace '\d+', 'XXXX')
What you're solving

regex test and substitution