Show formatted text of an entities attribute in a card

Short version:
I have an entity that looks something like this: fe54:76fa:09fe%2, 192.168.1.2
I need it to display JUST 192.168.1.2

Complete version:
I use HASSAGENT to monitor/control several of the windows computers in my house. Most of the computers are set up tp broadcast to HA the network configuration, that includes an attribute in the entity called “ipaddresses”. That attribute contains the IPV4 and IPV6 addresses of the network card, seemingly separated by a comma. The issue with that is a) I don’t care about the IPV6 address, and b) The IPV6 address is so long, that even if I could just ignore it, it doesn’t show the IPV4 in the card.
I assume there is likely some sort of code I can place in the editor that will format and only give the second “part” of the attribute, but since I don’t know much about how the code works… I didn’t even know what to search for.
Thanks in advance.

You can use a template in a markdown card:

type: markdown
content: |
    The IPv4 address is {{ state_attr('sensor.your_sensor_here', 'ipaddresses')[1] }}

That will only work if your attribute is a list. If it is a string you will have to use:

type: markdown
content: |
    The IPv4 address is {{ state_attr('sensor.your_sensor_here', 'ipaddresses')|split(', ')[1] }}

If you want to use an entities card instead of a markdown card you will have to create a template sensor in your configuration.yaml file (not sensors.yaml file).

template:
  sensor:
    - name: "IPv4 Address"
      state: "{{ state_attr('sensor.your_sensor_here', 'ipaddresses')[1] }}" # or the other template if a string

You can then use this entity in any card.