.Net Regex question!

Posted by Tsury on Stack Overflow See other posts from Stack Overflow or by Tsury
Published on 2010-03-26T11:06:25Z Indexed on 2010/03/26 11:13 UTC
Read the original article Hit count: 101

Filed under:
|

Supposed I have the following string:

string str = "<tag>text</tag>";

And I would like to change 'tag' to 'newTag' so the result would be:

"<newTag>text</newTag>"

What is the best way to do it?

I tried to search for <[/]*tag> but then I don't know how to keep the optional [/] in my result...

© Stack Overflow or respective owner

Related posts about regex

Related posts about c#