Skip to content

Instantly share code, notes, and snippets.

@buaziz
Created April 10, 2020 19:15
Show Gist options
  • Select an option

  • Save buaziz/d6375ccd5e2fc89a871a189521176436 to your computer and use it in GitHub Desktop.

Select an option

Save buaziz/d6375ccd5e2fc89a871a189521176436 to your computer and use it in GitHub Desktop.
PowerShell - Extract Text Between Quotes
$input_path = "C:\file-to-search.txt"
#$output_file = "C:\output.txt"
$regex = '(?<=")(?:\\.|[^"\\])*(?=")'
$versionNumber = select-string -Path $input_path -Pattern $regex -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value }
Write-Output "versionNumber : $versionNumber"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment