Re: strip_tags not recognising comments
| From: | Monte Ohrt | Date: | Thu, 24 Aug 2000 18:47:15 +0000 |
| Subject: | Re: strip_tags not recognising comments | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13497@lists.php.net to get a copy of this message | ||
There is an example of converting html to text in the php manual you
might
be interested in. It takes care of HTML, javascript, html entities, etc.
Take a look at example #3:
http://www.php.net/manual/function.preg-replace.php
Monte
Wico de Leeuw wrote:
>
> At 17:41 24-8-00 +0200, Wico de Leeuw wrote:
> >At 11:23 24-8-00 -0400, Matthew Luchak wrote:
> >>hey all,
> >>Thanks to those who answered my previous question "split array". I put my
> >>solution at the bottom of this mail for those interested (I neglected to say
> >>i need to use PHP3). On to the question at hand.
> >>Using strip_tags to parse out HTML chokes on comments that include URLS ie:
> >>
> >> <!-- <a href="NNN">MMM</a> -->
> >> gives
> >> MMM</a> --
>
> btw it doens't stip javascript to
>
> Greetz,
>
> Wico
>
> >>I tried: ereg_replace ("<!--.*-->"," ",$text);
> >>before striping the tags but this removes the <title> tag (most likely more
> >>than that but this is the obvious fault). Any insight on this?
> >
> >Try:
> >
> >Preg_Replace ("'(<!--.*?-->)'", "", $text);
> >
> >
> >
> >
> >
> >>##################################
> >>$ind=0;
> >>$newstuff = array();
> >>while (list($i,$v)=each($stuff))
> >>{
> >> if (strlen($v)>750) {
> >> for($j=0;$j<strlen($v);$j+=750){
> >> $newstuff[$ind++]=substr($v,$j+1,750);
> >> }
> >> } else {
> >> $newstuff[$ind++]=$v;
> >> }
> >>
> >>}
> >>##################################
> >>
> >>Matthew Luchak
> >>Senior Developer
> >>Special Projects
> >>Mamma.com
> >>http://www.62662.com
> >>http://www.Mamma.com
> >>tel: 514-908-4336
> >>matthew@mamma.com
> >>
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> >>For additional commands, e-mail: php-general-help@lists.php.net
> >>To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> >For additional commands, e-mail: php-general-help@lists.php.net
> >To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/