I have a variable that is holding two values from a table (using -expandproperty
)
$variable = "value1,value2"
I have a check to make sure $variable
doesnt have any NULL/empty value returned
if(($variable.Split(",") | Where { $_ -match '^\S'}).count -lt 1)
{write "no value!"}
else
{write $variable}
but for some reason, even though '^\S'
is supposed to ONLY check the first character/index for a whitespace, it outputs "
no value
" condition result...it should be outputting
value1,value2
instead...
not only that, but if the table column value is NULL
, it doesnt recognize it and instead tried to output the second condition write $variable
why is that??