Powershell select-string with variable extraction

#Multiline powershell regex with variable extraction.

$data = @”
first
second
third
“@

$data | Select-string -Pattern “(?s)first(?.*)third” | select -ExpandProperty Matches | foreach { $_.Groups[“name”].Value}

Leave a comment