diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md index 1bfafbe7847..cf7500531b4 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md @@ -1,5 +1,5 @@ --- -ms.date: 2017-12-01 +ms.date: 2017-12-06 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet @@ -167,9 +167,9 @@ Switch has the following parameters: | |condition. Wildcard and Exact are ignored. Also, if the | | |match clause is not a string, this parameter is ignored. | +In this example, there is no matching case so there is no output. ```powershell -Example: PS> switch ("fourteen") { 1 {"It is one."; Break} @@ -179,7 +179,12 @@ Example: 3 {"Three again."; Break} "fo*" {"That's too many."} } +``` + +For the word "fourteen" to match a case you must use the **-Wildcard** or +**-Regex** parameter. +```powershell PS> switch -Regex ("fourteen") { 1 {"It is one."; Break} @@ -189,6 +194,11 @@ Example: 3 {"Three again."; Break} "fo*" {"That's too many."} } + ``` + + Result: + + ```Output That's too many. ```