Sorry I'm new to this, but I couldn't find an answer to a question that I most certainly do not even know how to ask.
Lets say I have an XML file that has something like this:
<fields>
<field1>
<name>Frank</name>
</field1>
<field2>
<name>Bob</name>
</field2>
<field3>
<name>Spam</name>
</field3>
</fields>
And I would like to delete any where name = Bob. I can try
regex = re.compile("<fields>.*<field/d><name>Bob</field/d>.*</fields>"
data = regex.sub("", data"
My delimma is that everything between and is deleting. How can I specify that I want the /d to be the same for both, so that I can delete only what's between and ? In effect, I want the resulting XML to look like
<fields>
<field1>
<name>Frank</name>
</field1>
<field3>
<name>Spam</name>
</field3>
</fields>
thanks!