File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
reference/5.1/Microsoft.PowerShell.Core/About Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- ms.date : 2017-12-01
2
+ ms.date : 2017-12-06
3
3
schema : 2.0.0
4
4
locale : en-us
5
5
keywords : powershell,cmdlet
@@ -167,9 +167,9 @@ Switch has the following parameters:
167
167
| | condition. Wildcard and Exact are ignored. Also, if the |
168
168
| | match clause is not a string, this parameter is ignored. |
169
169
170
+ In this example, there is no matching case so there is no output.
170
171
171
172
``` powershell
172
- Example:
173
173
PS> switch ("fourteen")
174
174
{
175
175
1 {"It is one."; Break}
@@ -179,7 +179,12 @@ Example:
179
179
3 {"Three again."; Break}
180
180
"fo*" {"That's too many."}
181
181
}
182
+ ```
183
+
184
+ For the word "fourteen" to match a case you must use the ** -Wildcard** or
185
+ ** -Regex** parameter.
182
186
187
+ ``` powershell
183
188
PS> switch -Regex ("fourteen")
184
189
{
185
190
1 {"It is one."; Break}
@@ -189,6 +194,11 @@ Example:
189
194
3 {"Three again."; Break}
190
195
"fo*" {"That's too many."}
191
196
}
197
+ ```
198
+
199
+ Result:
200
+
201
+ ``` Output
192
202
That's too many.
193
203
```
194
204
You can’t perform that action at this time.
0 commit comments