|
|
@ -2,6 +2,7 @@ |
|
|
|
param( |
|
|
|
param( |
|
|
|
$Str, |
|
|
|
$Str, |
|
|
|
$Regex, |
|
|
|
$Regex, |
|
|
|
|
|
|
|
[switch] $Exclude, |
|
|
|
[switch] $End |
|
|
|
[switch] $End |
|
|
|
) |
|
|
|
) |
|
|
|
# Regex 可輸入複數個 |
|
|
|
# Regex 可輸入複數個 |
|
|
@ -25,6 +26,20 @@ |
|
|
|
} else { $Result.Remove("Anchor") } |
|
|
|
} else { $Result.Remove("Anchor") } |
|
|
|
$Result |
|
|
|
$Result |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ($Exclude) { |
|
|
|
|
|
|
|
$InterSB = { |
|
|
|
|
|
|
|
if ($_["Target"] -match $_["Regex"]) { |
|
|
|
|
|
|
|
$Result = @{ |
|
|
|
|
|
|
|
$key = $Matches[$key] |
|
|
|
|
|
|
|
# 將錨定字串中的特殊字元轉換為一般字串 |
|
|
|
|
|
|
|
Anchor = $Matches[0] -replace "([\[\]\(\)])", '\$1' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$LR = $_["Target"] -split $Result["Anchor"] |
|
|
|
|
|
|
|
$Result.Add("L", $LR[0]) |
|
|
|
|
|
|
|
$Result.Add("R", $LR[1]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|