php-general | 2001122
Date: 12/31/01
- Next message: John Monfort: "[PHP] Regular Expression Help"
- Previous message: Brian Clark: "Re: [PHP] How to strip off all html-comments"
- In reply to: Brian Clark: "Re: [PHP] How to strip off all html-comments"
- Next in thread: Mike Eheler: "[PHP] Re: How to strip off all html-comments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Martin,
strip_tags() would be useful for removing *all* HTML from a string, though
you can specify that certain tags should be retained. For example, if you
want to remove all *but* anchor tags from your string, your function would
look like this:
$str = strip_tags($str,'<a>');
However, if you want to remove *just* comment tags, though, you're better
off using the ereg_replace() or eregi_replace() function to remove the
comment tags, something like this:
$str = eregi_replace("<!--[^>]*-->","",$str);
...which would be a lot easier than including every other possible tag in
the second field of the strip_tags() function.
This regexp is very similar to one that I used to remove img tags from a
string in a project I was working on.
Good luck!
At 07:58 AM 12/31/2001, Brian Clark wrote:
>* James Cox (james <email protected>) [Dec 31. 2001 06:38]:
>
> > http://www.php.net/stripcodes
>
>I think you mean strip_tags()
>
><http://www.php.net/strip_tags>
>
>[...]
>
> > > Hello! How can I easily strip off all html-comments (<! Comment >) from
> > > a string?
>
> > > Martin
>
>--
>Brian Clark | Avoiding the general public since 1805!
>Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8
>Forget Napster. Why not really break the law?
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe <email protected>
>For additional commands, e-mail: php-general-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>
Sliante,
Richard S. Crawford
http://www.mossroot.com
AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford
MSN: underpope <email protected>
"It is only with the heart that we see rightly; what is essential is
invisible to the eye." --Antoine de Saint Exupéry
"Push the button, Max!"
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: John Monfort: "[PHP] Regular Expression Help"
- Previous message: Brian Clark: "Re: [PHP] How to strip off all html-comments"
- In reply to: Brian Clark: "Re: [PHP] How to strip off all html-comments"
- Next in thread: Mike Eheler: "[PHP] Re: How to strip off all html-comments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

