Skip to content

Instantly share code, notes, and snippets.

@vexx32
Created November 22, 2019 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vexx32/824cb519f6cc6d0f3486233753362919 to your computer and use it in GitHub Desktop.
Save vexx32/824cb519f6cc6d0f3486233753362919 to your computer and use it in GitHub Desktop.
# For testing only; replace $lines with Get-Content $File
$lines = @"
Name1=nameHere Value=
Name2=nameHere Value=someValue
"@ -split '\r?\n'
$KeyValuePairs = $lines | ForEach-Object {
if ($_ -match '^Name[0-9]+=(?<Name>.*?) Value=(?<Value>.*?)$') {
$matches.Remove(0)
$matches.Clone()
}
}
$KeyValuePairs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment