From a16f3346215bc5a475cd39a62713cb83029e0191 Mon Sep 17 00:00:00 2001 From: Yuriy Samorodov Date: Wed, 6 Dec 2017 17:40:41 +0300 Subject: [PATCH 1/2] Line 192 Single Quote Breaks Example --- reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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..9eaf19ed452 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 @@ -189,7 +189,7 @@ Example: 3 {"Three again."; Break} "fo*" {"That's too many."} } -That's too many. +That`'s too many. ``` Multiple instances of Regex, Wildcard, or Exact are permitted. However, From b4f1c7699b05e35b0d2e218680ae598452131ef0 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Wed, 6 Dec 2017 07:45:13 -0800 Subject: [PATCH 2/2] clarified the example for -Regex --- .../About/about_Switch.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 9eaf19ed452..cf7500531b4 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md @@ -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,7 +194,12 @@ Example: 3 {"Three again."; Break} "fo*" {"That's too many."} } -That`'s too many. + ``` + + Result: + + ```Output +That's too many. ``` Multiple instances of Regex, Wildcard, or Exact are permitted. However,