I have a xml file with this data format
<row Id="9" Body="aaaaaaaaa" Target="123456" />
I want to find & replace all Body=""
things with a space from my xml file. What is the regex for that?
I have a xml file with this data format
<row Id="9" Body="aaaaaaaaa" Target="123456" />
I want to find & replace all Body=""
things with a space from my xml file. What is the regex for that?
There are many possibilities, here is one way to remove the content from the Body
attribute
(<row.*Body=").*?("[^>]+>)
This creates two capturing groups for the content before and after the Body
attribute. Then, you just use those capturing groups for the replacement:
$1$2
It will transform:
<row Id="9" Body="aaaaaaaaa" Target="123456" />
Into:
<row Id="9" Body="" Target="123456" />
You can see it working here.