I am sorry, I was out to meet my wife from her work... And I fear in a few hours the night came here and I shall be offline again ;-)
Let us return to our question.
I could not tell I understand completely the things... Why people are dragging something "into application" and what happen then... Some HTML code should be grabbed from page and sent to server? then displayed elsewhere? And at that time should it or should not contain such elements?
But all this is secondary. What I was trying to tell, may be bit hastily, is that I suppose you use wrong idea (regexp + replace) to search for elements which you want to remove. Document is represented as a DOM-tree in a browser and it is easier to use jQuery search mechanisms.
jQuery(...elements selector...).remove() would remove the elements all right and you can get .innerHTML after that. I shall try to provide some example in a few minutes...