diff --git a/NameRegex.ps1 b/NameRegex.ps1 index 5c55a25..acdf21e 100644 --- a/NameRegex.ps1 +++ b/NameRegex.ps1 @@ -11,9 +11,10 @@ if ($Str -match $_ -and($key)) { $Result = @{ $key = $Matches[$key] - anchor = $Matches[0] + # 將錨定字串中的特殊字元轉換為一般字串 + Anchor = $Matches[0] -replace "([\[\]\(\)])", '\$1' } - $LR = $Str -split $Result["anchor"] + $LR = $Str -split $Result["Anchor"] $Result.Add("L", $LR[0]) $Result.Add("R", $LR[1]) $Result