I need to either replace an existing tag attribute, or add it if it doesn't exist.
For example if preg_replace finds:
<polygon fill-rule="evenodd" clip-rule="evenodd" points="122"/>
then it needs to add:
fill="#231F20"
as a new attribute, but if it finds:
<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#000000" points="122"/>
then it needs to simply replace:
fill="#000000"
with:
fill="#231F20"
Keep in mind that it will come across other fill attributes (in other polygon tags) set to other colors that must be ignored, so I can't simply use remove them all and then add in just the replacement fill tag.
Thanks