EDIT:
function myfunc {
param (
[Parameter(ValueFromPipeline=$True)]
[string[]]$names = ('joe','john','dave','dan')
)
begin {
$list = 'joe','john','dave','dan'
$options = [Management.Automation.WildcardOptions]'IgnoreCase,Compiled'
}
process {
foreach ($name in $names) {
if ([WildcardPattern]::ContainsWildcardCharacters($name)) {
$wildcard = [WildcardPattern]::new($name, $options)
foreach($item in $list) {
if (-not $wildcard.IsMatch($item)) { continue }
$item
}
} else {
$name
}
}
}
}
PS /Users/js> myfunc j*,d*
joe
john
dave
dan
PS /Users/js> echo j*,d* | myfunc
joe
john
dave
dan
PS /Users/js> myfunc fred,barney
fred
barney
PS /Users/js> $options
Compiled, IgnoreCase