I have a sample array and I try to create a rule which will filter our either of the 2 items that are present in the array.
Sample array:
$d_c_arr = @('idata', 'quanthouse', 'reuters', 'bloomberg', 'fidelity', 'nasdaq')
The items that I want to filter out are ' idata
' and ' quanthouse
'.
The filtering rule should adapt to the situations where either both ' idata
' and ' quanthouse
' exist or only one of them is present in an array.
My attempt to define the rule:
$d_c_arr | Where-Object { $_ -notlike 'idata' -or $_ -notlike 'quanthouse' }
My expected output would be:
reuters
bloomberg
fidelity
nasdaq
However, the actual output is:
idata
quanthouse
reuters
bloomberg
fidelity
nasdaq
How to properly define the rule which would filter either of the 2 selected items in the array?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.