Removing tags from HTML code

Removing tags from HTML code

Removing tags from HTML code

I have some HTML code in a TRichEdit and I want to strip out all the tags to leave the text I am interested in. For example, filtering this HTML code:<HTML><HEAD> <TITLE> My Site </TITLE></HEAD><BODY> <B> Lots of useful information </B> <H1> And some more </H1></BODY></HTML>would give the following as output: My Site Lots of useful information And some more

Unfortunately, I had to put a limit on how many tags it removes because it seems to mess up when it finds the 190th tag! The code works as required up to this point. Another problem is that lots of whitespace is still floating around after doing this. Btw, the text is about 61,000 characters over 1300 lines.