Vb.net Regex - remove html tags from string

regex, vb.net, winforms

Solution

replace this regex `<span.+?</span>` with empty string

Regex.Replace(elm.InnerHtml, @"<span.+?</span>", String.Empty)

if you want save text between tags use this one `</?span.*?>`

Regex.Replace(elm.InnerHtml, @"</?span.*?>", String.Empty)

Problem

My String Is : ``` <span class="name">name1</span><br> <span class="name">name2</span> ``` i want to remove : `"<span ...>"` and `"</span>"` from my string, i can use the simple replace function, but regex is better because the operators. i tried: ``` Regex.Replace(elm.InnerHtml, "<(.|\n)+?>", String.Empty) ``` but: ``` <(.|\n)+?> ``` remove all html tags , and i need to remove span only.

Original source