From c38a1e79170c8da93973cee11e9b709d0e78cbfb Mon Sep 17 00:00:00 2001 From: pcnick Date: Fri, 3 Dec 2021 00:03:49 +0800 Subject: [PATCH] Get-NameRegex: finish anchor split file name, and return Hash object. --- NameRegex.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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