Help in understanding a line of code

$arp = arp -a | Where {$_ -and $_ -notmatch ‘internet address\s+physical address\s+type’}

What i dont get here is the "$_ -and $_ " part.
i get that this gets the output of arp -a and then brings back everything except the phrase in the regex.
i know the $_ is the piped data but i still dont understand that condition, help?

That’s not a really well-written Where clause, honestly.

It’s saying, “where $_ contains something, and where $_ does not match the following regular expression.”

I’d prefer:

$_ -ne $null -and $_ -notmatch 'internet address\s+physical address\s+type'

Or something a little more declarative.

Thanks for the fast response i think ill implement it your way since it is more informative, can i use the PSItem instead of the $_? or it may cause some compatibility issues with other PS vers?

$PSItem was introduced in v3.