I realised the stuff i posted is just the pipeline so let me rephrase my question:
I do an nslookup of the mail server and i get several IP Addresses. The string should be in a variable f.e. $result and the output should be in a structure in an array. Is there some kind of regex to select the relevant IP addresses?
The same would i like to do with the network policy: kubectl get networkpolicy -n -o jsonpath='{.spec}'
I would like to transform the JSON to a Powershell-Object and the relevant output into a "loop" with the IP addresses compare.
Compare the IP addresses from nslookup with IPs in the network policy.
how to do the syntax?