I saw many similar question, but still not found the answer.
How should look the regex, that needs to replace all whitespaces (include newline) in HTML, but ignore the tag?
Currently I use Regex.Replace(content, @"\s+", "");
but in removes spaces in JavaScript that exists on page and than the page not works.
Thank you.
EDIT: After some question in responses, here a little bit more details: What I'm doing is HTTP module that "minifies" HTML output on our site. We have a web site with very dynamic content that came from many different sources. The final goal, is to reduce page size and reduce network traffic. It's a highly loaded web site so it's important to us to complete that.
Actually we are using MbCompression library for JS and CSS minification, but it not supports to minify HTML output (at least i didn't found).