Can I just add. The reason I am trying to do this is because I am using an HTMLAREA object that is passing some rather nasty code comments through to my posted parameter that I need to remove before it goes into my database. Therefore I should be able to remove it from the posted string?
I dont know why the expression is not working for me?? But If I output the str to HTML it still apears to be a comment. Have you any ideas why it is not working?
In case someone comes in here and wants to strip tags away from theire html code, they might want to read up on strip_tags().
If they only want to strip one tag though, the samples above might be a easier way to go, as then they dont have to define all the tags which are allowed.
The expression will not only strip out HTML comments but also Apache SSI directives (which are syntactically like HTML comments but have a # after the opening:
<!--#
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.