I am having an array $IPAddress which contains IPv4 and IPv6 address like below.
IPAddress : {166.33.77.15, fe90::68fe:7602:d981:2cb}
IPAddress : {166.33.77.18, fe87::67c0:8476:3509:fb7a}
IPAddress : {166.33.77.65, fe80::c08e:f5ec:5095:e7ec}
I would like to store in my IPaddress array only the IPv4 address. I need to cut after ‘{‘ till ‘,’. How to do this using powershell?
If the result is an object then you can simply do:
If it’s a string, try using a regex: