Need help in creating this regex

Hello Community,

I have a file, with some data.
I need the regex that matches a text only within the Title=“”, but ignore if the text is within square brackets, and not others for ex. Link, BreakType etc

The word i want to match is Color.

Input:

<TocEntry
      Title="Color" 
Title=["Color"] 
      Link="/Content/Color/" 
      BreakType="Color"
      StartSection="false"
      PageNumberReset="Color">
</TocEntry>
<TocEntry
      Title="Colord"> 
      //there could be Link="abc", BreakType="abc" here aswell
</TocEntry>
<TocEntry
      Title="dColord"> 
</TocEntry>

<TocEntry
      Title="my fav Color is red">
Title=["my fav Color is red"]>
</TocEntry>

Output:

<TocEntry
      Title="Color" - Highlight this text Color
Title=["Color"] - Ignore  this text Color
      Link="/Content/Color/" - ignore this text Color
      BreakType="Color" - ignore this text Color
      StartSection="false"
      PageNumberReset="Color"> - ignore this text Color
</TocEntry>
<TocEntry
      Title="Colord"> - ignore this text Colord
      //there could be Link="abc", BreakType="abc" here aswell
</TocEntry>
<TocEntry
      Title="dColord"> - ignore this text dColord
</TocEntry>

<TocEntry
      Title="my fav Color is red"> - Highlight this text Color
Title=["my fav Color is red"]> -  - ignore this text Color
</TocEntry>

@hansen_Lobo
Try and let me know

It works to some extent,

But i need to match it only for Color, not dColor or Colord, or the entire string with it. Just the particular term.

@hansen_Lobo
You want to higlight only color from last line

yes, thats right, not the entire string nor Dcolor or colord. Exactly Color

1 Like

Why not use Deserialize XML to get it into an XML object, then use proper XML object calls to get the data you need?

@hansen_Lobo
Try this one:

Duplicate :