Uipath regex replacement in a file

Hello Community
I have a file and a word(Color) has to be replaced with another word (Colour).
Here are some conditions:

  1. Replace the word only if its within Color tag
  2. Do not replace the word Color if its within square bracket in [Color] Color tag, but the Color outside the square bracket needs to be replaced

Input Sample

<variable>[Color]Color</variable> - ignore the Color in bracket,  but highlight the loves outside it
<variable>A car with red Color</variable>
<variable>dColor</variable> - ignore
<variable> Color</variable>
<variable>Colord</variable> - ignore
<variable class="Color">Color</variable>  - ignore the Color in within <variable class="Color">,  but highlight the Color outside it
<variable>A car with
red Color
looks nice</variable>

Since this is XML you could use Deserialize XML to get it into an XML object and then use XML features to get and change the values you want.