Replace xml tag with regex

Posted by Kai on Stack Overflow See other posts from Stack Overflow or by Kai
Published on 2010-04-16T19:34:24Z Indexed on 2010/04/16 19:43 UTC
Read the original article Hit count: 238

Filed under:
|
|

How can I replace a certain part in a xml file with a definied string?

<tag1></tag2>
<tag2></tag2>
...etc
<soundcard num=0> 
<name>test123</name>
</soundcard>
<soundcard num=1> 
<name>test123</name>
</soundcard>
<soundcard num=2> 
<name>test123</name>
</soundcard>
<tag5></tag5>

replace all soundcard parts that the result looks like that:

<tag1></tag2>
<tag2></tag2>
...etc
{0}
<tag5></tag5>

I'm using c# .net 3.5 and I thougt of a regex solution

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex