1

I have some html content who have some classes and inline stylesheet. i want a c# function who return the content by removing all attributes from them like

<div class="blah blah1 blah2" id="info" style="">it is content</div>

return

<div>it is content</div>

I want to do this in c# using regex.

how i can do this in c#

Deduplicator
  • 43,322
  • 6
  • 62
  • 109

1 Answers1

3

This sounds like a job for the HTML Agility Pack

Justin
  • 82,493
  • 48
  • 216
  • 356
  • this is nonsense to do a task by adding a third patry comp when can be done by a regex –  Mar 11 '11 at 09:56
  • 1
    This is not nonsense, if you want to do it properly, do not use Regex.. see http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags – Roger Johansson Feb 01 '15 at 17:19