diff --git a/functions/public/Invoke-WPFToggleAllCategories.ps1 b/functions/public/Invoke-WPFToggleAllCategories.ps1 index 960a265d..6b0745d1 100644 --- a/functions/public/Invoke-WPFToggleAllCategories.ps1 +++ b/functions/public/Invoke-WPFToggleAllCategories.ps1 @@ -40,7 +40,8 @@ function Invoke-WPFToggleAllCategories { # Update the label to show the correct state $categoryLabel = $categoryContainer.Children[0] if ($categoryLabel.Content -like "$sourcePrefix*") { - $categoryLabel.Content = $categoryLabel.Content -replace "^$sourcePrefix ", "$targetPrefix " + $escapedSourcePrefix = [regex]::Escape($sourcePrefix) + $categoryLabel.Content = $categoryLabel.Content -replace "^$escapedSourcePrefix ", "$targetPrefix " } } }