Using regular expression to trim html

Posted by Tim on Stack Overflow See other posts from Stack Overflow or by Tim
Published on 2009-06-02T17:51:22Z Indexed on 2010/06/14 5:02 UTC
Read the original article Hit count: 229

Filed under:
|
|

Been trying to solve this for a while now.

I need a regex to strip the newlines, tabs and spaces between the html tags demonstrated in the example below:

Source:

<html>
   <head>
     <title>
           Some title
       </title>
    </head>
</html>

Wanted result:

<html><head><title>Some title</title></head></html>

The trimming of the whitespaces before the "Some title" is optional. I'd be grateful for any help

© Stack Overflow or respective owner

Related posts about c#

Related posts about html