Text Processing12 / 14
Up next

-match and $matches

$log = "GET /api/users 200"
if ($log -match '(\w+)\s+(\S+)\s+(\d+)') {
    # verb=GET path=/api/users code=200
    "verb=$($matches[1]) path=$($matches[2]) code=$($matches[3])"
}
What you're solving

test a pattern, then read the capture groups