You are here: Re: [PHP] stripping html tags « PHP « IT news, forums, messages
Re: [PHP] stripping html tags

Posted by "Richard Lynch" on 06/06/05 02:43

On Sun, June 5, 2005 7:05 am, Dotan Cohen said:
> I took this example from php.net, but can't figure out where I went
> wrong. Why does this:
> $text = preg_replace("/<head(.|\s)*?>(.|\s)*?<\/head>/i" , "" , $text);
>
> throw this error:
> syntax error at line 265, column 39:
> $text = preg_replace("/<head(.|\s)*?>(.|\s)*?<\/head>/i" , "" , $text);
> ======================================^
>
> It seems to be pointing to the 'e' is 'head'. Why? Thanks.

The pointing is often "off" by a few chars...

For starters, you're not correctly using \, imho.

\ is special in PHP strings.
\ is ALSO special in RegEx.

So your \s should be \\s, in case PHP makes \s special someday.

I think the ?> in there will also mess you up, maybe, as that ends PHP
parsing... Though it SHOULD be kosher inside a string...

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация