diff --git a/PSIni/Functions/Get-IniContent.ps1 b/PSIni/Functions/Get-IniContent.ps1 index 3adc7dd..c61d613 100644 --- a/PSIni/Functions/Get-IniContent.ps1 +++ b/PSIni/Functions/Get-IniContent.ps1 @@ -89,7 +89,7 @@ $commentRegex = "^\s*([$($CommentChar -join '')].*)$" $sectionRegex = "^\s*\[(.+)\]\s*$" - $keyRegex = "^\s*(.+?)\s*=\s*(['`"]?)(.*)\2\s*$" + $keyRegex = "^\s*(.+?)\s*=\s*((['`"]*).*\3)\s*$" Write-Debug ("commentRegex is {0}." -f $commentRegex) } @@ -141,7 +141,7 @@ $section = $script:NoSection $ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase) } - $name, $value = $matches[1, 3] + $name, $value = $matches[1, 2] Write-Verbose "$($MyInvocation.MyCommand.Name):: Adding key $name with value: $value" if (-not $ini[$section][$name]) { $ini[$section][$name] = $value diff --git a/PSIni/Functions/Out-IniFile.ps1 b/PSIni/Functions/Out-IniFile.ps1 index c52cd3c..854725f 100644 --- a/PSIni/Functions/Out-IniFile.ps1 +++ b/PSIni/Functions/Out-IniFile.ps1 @@ -70,7 +70,7 @@ Function Out-IniFile { # -- Unicode: Encodes in UTF-16 format using the little-endian byte order. # -- UTF7: Encodes in UTF-7 format. # -- UTF8: Encodes in UTF-8 format. - [ValidateSet("Unicode", "UTF7", "UTF8", "ASCII", "BigEndianUnicode", "Byte", "String")] + [ValidateSet("Unicode", "UTF7", "UTF8", "ASCII", "BigEndianUnicode", "Byte", "String", "Default")] [Parameter()] [String] $Encoding = "UTF8", @@ -123,7 +123,7 @@ Function Out-IniFile { [System.Collections.IDictionary] $InputObject, - [ValidateSet("Unicode", "UTF7", "UTF8", "ASCII", "BigEndianUnicode", "Byte", "String")] + [ValidateSet("Unicode", "UTF7", "UTF8", "ASCII", "BigEndianUnicode", "Byte", "String", "Default")] [Parameter( Mandatory )] [string] $Encoding = "UTF8",