使用通配符参数 switch 语句

-Wildcard 参数允许 switch 语句对条件执行通配符匹配。

例:

switch -Wildcard ('Condition')
{ 
    'Condition'           {'Normal match'}
    'Condit*'             {'Zero or more wildcard chars.'} 
    'C[aoc]ndit[f-l]on'   {'Range and set of chars.'}  
    'C?ndition'           {'Single char. wildcard'}
    'Test*'               {'No match'} 
}

输出:

Normal match
Zero or more wildcard chars.
Range and set of chars.
Single char. wildcard